Enabling / disabling of the layer editing button on OSX & linux did not work.
This commit is contained in:
bubnikv 2017-02-13 12:40:12 +01:00
parent e2f8ea2809
commit fd54956d70

View File

@ -1636,12 +1636,21 @@ sub on_config_change {
$self->Layout; $self->Layout;
} elsif ($opt_key eq 'variable_layer_height') { } elsif ($opt_key eq 'variable_layer_height') {
if ($config->get('variable_layer_height') != 1) { if ($config->get('variable_layer_height') != 1) {
$self->{"btn_layer_editing"}->Disable; if ($self->{htoolbar}) {
$self->{"btn_layer_editing"}->SetValue(0); $self->{htoolbar}->EnableTool(TB_LAYER_EDITING, 0);
$self->{htoolbar}->ToggleTool(TB_LAYER_EDITING, 0);
} else {
$self->{"btn_layer_editing"}->Disable;
$self->{"btn_layer_editing"}->SetValue(0);
}
$self->{canvas3D}->layer_editing_enabled(0); $self->{canvas3D}->layer_editing_enabled(0);
$self->{canvas3D}->update; $self->{canvas3D}->update;
} else { } else {
$self->{"btn_layer_editing"}->Enable; if ($self->{htoolbar}) {
$self->{htoolbar}->EnableTool(TB_LAYER_EDITING, 1);
} else {
$self->{"btn_layer_editing"}->Enable;
}
} }
} }
} }
@ -1746,25 +1755,28 @@ sub object_settings_dialog {
# whether background processing (export of a G-code, sending to Octoprint, forced background re-slicing) is active. # whether background processing (export of a G-code, sending to Octoprint, forced background re-slicing) is active.
sub object_list_changed { sub object_list_changed {
my $self = shift; my $self = shift;
# Enable/disable buttons depending on whether there are any objects on the platter. # Enable/disable buttons depending on whether there are any objects on the platter.
my $have_objects = @{$self->{objects}} ? 1 : 0; my $have_objects = @{$self->{objects}} ? 1 : 0;
my $method = $have_objects ? 'Enable' : 'Disable'; if ($self->{htoolbar}) {
$self->{"btn_$_"}->$method # On OSX or Linux
for grep $self->{"btn_$_"}, qw(reset arrange reslice export_gcode export_stl print send_gcode layer_editing); $self->{htoolbar}->EnableTool($_, $have_objects)
$self->{"btn_layer_editing"}->Disable if (! $self->{config}->variable_layer_height); for (TB_RESET, TB_ARRANGE, TB_LAYER_EDITING);
$self->{htoolbar}->EnableTool(TB_LAYER_EDITING, 0) if (! $self->{config}->variable_layer_height);
} else {
# On MSW
my $method = $have_objects ? 'Enable' : 'Disable';
$self->{"btn_$_"}->$method
for grep $self->{"btn_$_"}, qw(reset arrange reslice export_gcode export_stl print send_gcode layer_editing);
$self->{"btn_layer_editing"}->Disable if (! $self->{config}->variable_layer_height);
}
if ($self->{export_gcode_output_file} || $self->{send_gcode_file}) { if ($self->{export_gcode_output_file} || $self->{send_gcode_file}) {
$self->{btn_reslice}->Disable; $self->{btn_reslice}->Disable;
$self->{btn_export_gcode}->Disable; $self->{btn_export_gcode}->Disable;
$self->{btn_print}->Disable; $self->{btn_print}->Disable;
$self->{btn_send_gcode}->Disable; $self->{btn_send_gcode}->Disable;
} }
if ($self->{htoolbar}) {
$self->{htoolbar}->EnableTool($_, $have_objects)
for (TB_RESET, TB_ARRANGE);
}
} }
sub selection_changed { sub selection_changed {
@ -1773,13 +1785,15 @@ sub selection_changed {
my ($obj_idx, $object) = $self->selected_object; my ($obj_idx, $object) = $self->selected_object;
my $have_sel = defined $obj_idx; my $have_sel = defined $obj_idx;
my $method = $have_sel ? 'Enable' : 'Disable';
$self->{"btn_$_"}->$method
for grep $self->{"btn_$_"}, qw(remove increase decrease rotate45cw rotate45ccw changescale split cut settings);
if ($self->{htoolbar}) { if ($self->{htoolbar}) {
# On OSX or Linux
$self->{htoolbar}->EnableTool($_, $have_sel) $self->{htoolbar}->EnableTool($_, $have_sel)
for (TB_REMOVE, TB_MORE, TB_FEWER, TB_45CW, TB_45CCW, TB_SCALE, TB_SPLIT, TB_CUT, TB_SETTINGS); for (TB_REMOVE, TB_MORE, TB_FEWER, TB_45CW, TB_45CCW, TB_SCALE, TB_SPLIT, TB_CUT, TB_SETTINGS);
} else {
# On MSW
my $method = $have_sel ? 'Enable' : 'Disable';
$self->{"btn_$_"}->$method
for grep $self->{"btn_$_"}, qw(remove increase decrease rotate45cw rotate45ccw changescale split cut settings);
} }
if ($self->{object_info_size}) { # have we already loaded the info pane? if ($self->{object_info_size}) { # have we already loaded the info pane?