Bugfix: changes in extruder count in GUI were not propagating to the rest of the GUI
This commit is contained in:
parent
16b6cdcd6e
commit
321b70115b
@ -85,8 +85,13 @@ sub _init_tabpanel {
|
|||||||
my $tab;
|
my $tab;
|
||||||
$tab = $self->{options_tabs}{$tab_name} = ($class_prefix . ucfirst $tab_name)->new($panel);
|
$tab = $self->{options_tabs}{$tab_name} = ($class_prefix . ucfirst $tab_name)->new($panel);
|
||||||
$tab->on_value_change(sub {
|
$tab->on_value_change(sub {
|
||||||
|
my ($opt_key, $value) = @_;
|
||||||
|
|
||||||
my $config = $tab->config;
|
my $config = $tab->config;
|
||||||
$self->{plater}->on_config_change($config) if $self->{plater}; # propagate config change events to the plater
|
if ($self->{plater}) {
|
||||||
|
$self->{plater}->on_config_change($config); # propagate config change events to the plater
|
||||||
|
$self->{plater}->on_extruders_change($value) if $opt_key eq 'extruders_count';
|
||||||
|
}
|
||||||
if ($self->{loaded}) { # don't save while loading for the first time
|
if ($self->{loaded}) { # don't save while loading for the first time
|
||||||
if ($self->{mode} eq 'simple') {
|
if ($self->{mode} eq 'simple') {
|
||||||
# save config
|
# save config
|
||||||
|
@ -405,6 +405,17 @@ sub get_field {
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_value {
|
||||||
|
my $self = shift;
|
||||||
|
my ($opt_key, $value) = @_;
|
||||||
|
|
||||||
|
my $changed = 0;
|
||||||
|
foreach my $page (@{ $self->{pages} }) {
|
||||||
|
$changed = 1 if $page->set_value($opt_key, $value);
|
||||||
|
}
|
||||||
|
return $changed;
|
||||||
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::Tab::Print;
|
package Slic3r::GUI::Tab::Print;
|
||||||
use base 'Slic3r::GUI::Tab';
|
use base 'Slic3r::GUI::Tab';
|
||||||
|
|
||||||
@ -948,9 +959,7 @@ sub build {
|
|||||||
$optgroup->on_change(sub {
|
$optgroup->on_change(sub {
|
||||||
my ($opt_id) = @_;
|
my ($opt_id) = @_;
|
||||||
if ($opt_id eq 'extruders_count') {
|
if ($opt_id eq 'extruders_count') {
|
||||||
$self->{extruders_count} = $optgroup->get_value('extruders_count');
|
$self->_extruders_count_changed($optgroup->get_value('extruders_count'));
|
||||||
$self->_build_extruder_pages;
|
|
||||||
$self->_update;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1004,6 +1013,16 @@ sub build {
|
|||||||
$self->_build_extruder_pages;
|
$self->_build_extruder_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _extruders_count_changed {
|
||||||
|
my ($self, $extruders_count) = @_;
|
||||||
|
|
||||||
|
$self->{extruders_count} = $extruders_count;
|
||||||
|
$self->_build_extruder_pages;
|
||||||
|
$self->_update;
|
||||||
|
$self->set_dirty(1);
|
||||||
|
$self->_on_value_change('extruders_count', $extruders_count);
|
||||||
|
}
|
||||||
|
|
||||||
sub _extruder_options { qw(nozzle_diameter extruder_offset retract_length retract_lift retract_speed retract_restart_extra retract_before_travel wipe
|
sub _extruder_options { qw(nozzle_diameter extruder_offset retract_length retract_lift retract_speed retract_restart_extra retract_before_travel wipe
|
||||||
retract_layer_change retract_length_toolchange retract_restart_extra_toolchange) }
|
retract_layer_change retract_length_toolchange retract_restart_extra_toolchange) }
|
||||||
|
|
||||||
@ -1110,14 +1129,13 @@ sub _update {
|
|||||||
# this gets executed after preset is loaded and before GUI fields are updated
|
# this gets executed after preset is loaded and before GUI fields are updated
|
||||||
sub on_preset_loaded {
|
sub on_preset_loaded {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return;
|
|
||||||
# update the extruders count field
|
# update the extruders count field
|
||||||
{
|
{
|
||||||
# update the GUI field according to the number of nozzle diameters supplied
|
# update the GUI field according to the number of nozzle diameters supplied
|
||||||
$self->set_value('extruders_count', scalar @{ $self->{config}->nozzle_diameter });
|
my $extruders_count = scalar @{ $self->{config}->nozzle_diameter };
|
||||||
|
$self->set_value('extruders_count', $extruders_count);
|
||||||
# update extruder page list
|
$self->_extruders_count_changed($extruders_count);
|
||||||
$self->_on_value_change('extruders_count');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user