diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index c1df8b30e..a3c04cd25 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -506,17 +506,6 @@ sub repair_stl { Slic3r::GUI::show_info($self, "Your file was repaired.", "Repair"); } -sub extra_variables { - my $self = shift; - - my %extra_variables = (); - if ($self->{mode} eq 'expert') { - $extra_variables{"${_}_preset"} = $self->{options_tabs}{$_}->get_current_preset->name - for qw(print filament printer); - } - return { %extra_variables }; -} - sub export_config { my $self = shift; diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 8ab170ee6..fa04fc436 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -253,7 +253,7 @@ sub new { $self->{print_file} = $self->export_gcode(Wx::StandardPaths::Get->GetTempDir()); }); EVT_BUTTON($self, $self->{btn_send_gcode}, sub { - my $filename = basename($self->{print}->output_filepath($main::opt{output})); + my $filename = basename($self->{print}->output_filepath($main::opt{output} // '')); $filename = Wx::GetTextFromUser("Save to printer with the following name:", "OctoPrint", $filename, $self); @@ -530,12 +530,15 @@ sub update_presets { } if ($selected <= $#$presets) { + my $preset_name = $choice->GetString($selected); if ($is_dirty) { - $choice->SetString($selected, $choice->GetString($selected) . " (modified)"); + $choice->SetString($selected, "$preset_name (modified)"); } # call SetSelection() only after SetString() otherwise the new string # won't be picked up as the visible string $choice->SetSelection($selected); + + $self->{print}->placeholder_parser->set("${group}_preset", $preset_name); } } } @@ -1117,12 +1120,6 @@ sub start_background_process { return; } - # apply extra variables - { - my $extra = $self->GetFrame->extra_variables; - $self->{print}->placeholder_parser->set($_, $extra->{$_}) for keys %$extra; - } - # start thread @_ = (); $self->{process_thread} = Slic3r::spawn_thread(sub { @@ -1225,7 +1222,7 @@ sub export_gcode { if ($output_file) { $self->{export_gcode_output_file} = $self->{print}->output_filepath($output_file); } else { - my $default_output_file = $self->{print}->output_filepath($main::opt{output}); + my $default_output_file = $self->{print}->output_filepath($main::opt{output} // ''); my $dlg = Wx::FileDialog->new($self, 'Save G-code file as:', wxTheApp->output_path(dirname($default_output_file)), basename($default_output_file), &Slic3r::GUI::FILE_WILDCARDS->{gcode}, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if ($dlg->ShowModal != wxID_OK) { @@ -1489,7 +1486,7 @@ sub _get_export_file { my $output_file = $main::opt{output}; { - $output_file = $self->{print}->output_filepath($output_file); + $output_file = $self->{print}->output_filepath($output_file // ''); $output_file =~ s/\.gcode$/$suffix/i; my $dlg = Wx::FileDialog->new($self, "Save $format file as:", dirname($output_file), basename($output_file), &Slic3r::GUI::MODEL_WILDCARD, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);