Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-03-22 01:15:33 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-03-22 01:15:33 +0400
commit30aa255bb5cf0037179c16284b29b5ed586e3473 (patch)
treec6a137d2c54ac7aa8cdb17f3a8b30e11ecd7a73c
parentbf352de224ec64fb59010cd8f4a05d3b8cef869e (diff)
Correctly disable and reset the override settings panel
-rw-r--r--lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm5
-rw-r--r--lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm21
2 files changed, 22 insertions, 4 deletions
diff --git a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
index 0b02e89cc..2ba7e41ab 100644
--- a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
+++ b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
@@ -144,7 +144,8 @@ sub selection_changed {
# disable things as if nothing is selected
$self->{btn_delete}->Disable;
- $self->{settings_panel}->Disable;
+ $self->{settings_panel}->disable;
+ $self->{settings_panel}->set_config(undef);
my $itemData = $self->get_selection;
if ($itemData && $itemData->{type} eq 'volume') {
@@ -156,7 +157,7 @@ sub selection_changed {
my $volume = $self->{model_object}->volumes->[ $itemData->{volume_id} ];
my $material = $self->{model_object}->model->materials->{ $volume->material_id // '_' };
$material //= $volume->assign_unique_material;
- $self->{settings_panel}->Enable;
+ $self->{settings_panel}->enable;
$self->{settings_panel}->set_config($material->config);
}
diff --git a/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm b/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm
index 5bbe05198..8518b8320 100644
--- a/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm
+++ b/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm
@@ -26,10 +26,10 @@ sub new {
# get all options with object scope and sort them by category+label
my %settings = map { $_ => sprintf('%s > %s', $Slic3r::Config::Options->{$_}{category}, $Slic3r::Config::Options->{$_}{full_label} // $Slic3r::Config::Options->{$_}{label}) } @opt_keys;
$self->{options} = [ sort { $settings{$a} cmp $settings{$b} } keys %settings ];
- my $choice = Wx::Choice->new($self, -1, wxDefaultPosition, [150, -1], [ map $settings{$_}, @{$self->{options}} ]);
+ my $choice = $self->{choice} = Wx::Choice->new($self, -1, wxDefaultPosition, [150, -1], [ map $settings{$_}, @{$self->{options}} ]);
# create the button
- my $btn = Wx::BitmapButton->new($self, -1, Wx::Bitmap->new("$Slic3r::var/add.png", wxBITMAP_TYPE_PNG));
+ my $btn = $self->{btn_add} = Wx::BitmapButton->new($self, -1, Wx::Bitmap->new("$Slic3r::var/add.png", wxBITMAP_TYPE_PNG));
EVT_BUTTON($self, $btn, sub {
my $idx = $choice->GetSelection;
return if $idx == -1; # lack of selected item, can happen on Windows
@@ -96,4 +96,21 @@ sub update_optgroup {
$self->Layout;
}
+# work around a wxMAC bug causing controls not being disabled when calling Disable() on a Window
+sub enable {
+ my ($self) = @_;
+
+ $self->{choice}->Enable;
+ $self->{btn_add}->Enable;
+ $self->Enable;
+}
+
+sub disable {
+ my ($self) = @_;
+
+ $self->{choice}->Disable;
+ $self->{btn_add}->Disable;
+ $self->Disable;
+}
+
1;