Minor improvements to filament choosers in the plater
This commit is contained in:
parent
c2c321c90b
commit
0a9f1c466a
2 changed files with 17 additions and 6 deletions
|
@ -439,8 +439,14 @@ sub update_presets {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($group, $presets, $selected, $is_dirty) = @_;
|
my ($group, $presets, $selected, $is_dirty) = @_;
|
||||||
|
|
||||||
foreach my $choice (@{ $self->{preset_choosers}{$group} }) {
|
my @choosers = @{ $self->{preset_choosers}{$group} };
|
||||||
my $sel = $choice->GetSelection;
|
foreach my $choice (@choosers) {
|
||||||
|
if ($group eq 'filament' && @choosers > 1) {
|
||||||
|
# if we have more than one filament chooser, keep our selection
|
||||||
|
# instead of importing the one from the tab
|
||||||
|
$selected = $choice->GetSelection;
|
||||||
|
$is_dirty = 0;
|
||||||
|
}
|
||||||
$choice->Clear;
|
$choice->Clear;
|
||||||
foreach my $preset (@$presets) {
|
foreach my $preset (@$presets) {
|
||||||
my $bitmap;
|
my $bitmap;
|
||||||
|
@ -464,15 +470,16 @@ sub update_presets {
|
||||||
$choice->AppendString($preset->name, $bitmap);
|
$choice->AppendString($preset->name, $bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sel <= $#$presets) {
|
if ($selected <= $#$presets) {
|
||||||
$choice->SetSelection($sel);
|
|
||||||
if ($is_dirty) {
|
if ($is_dirty) {
|
||||||
$choice->SetString($sel, $choice->GetString($sel) . " (modified)");
|
$choice->SetString($selected, $choice->GetString($selected) . " (modified)");
|
||||||
|
}
|
||||||
|
# call SetSelection() only after SetString() otherwise the new string
|
||||||
|
# won't be picked up as the visible string
|
||||||
|
$choice->SetSelection($selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$self->{preset_choosers}{$group}[0]->SetSelection($selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub filament_presets {
|
sub filament_presets {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
|
@ -229,6 +229,10 @@ sub on_select_preset {
|
||||||
'Unsaved Changes', wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
|
'Unsaved Changes', wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
|
||||||
if ($confirm->ShowModal == wxID_NO) {
|
if ($confirm->ShowModal == wxID_NO) {
|
||||||
$self->{presets_choice}->SetSelection($self->current_preset);
|
$self->{presets_choice}->SetSelection($self->current_preset);
|
||||||
|
|
||||||
|
# trigger the on_presets_changed event so that we also restore the previous value
|
||||||
|
# in the plater selector
|
||||||
|
$self->_on_presets_changed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue