mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 11:40:46 +08:00
Bugfix: placeholders with preset names were not initialized without background processing. #3507
This commit is contained in:
parent
871f469c89
commit
5821f040c4
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user