Further reduction of Perl Config.pm methods.

This commit is contained in:
bubnikv 2017-10-27 18:52:35 +02:00
parent 3bc79e80d5
commit 2455aee97c
28 changed files with 118 additions and 136 deletions

View file

@ -202,7 +202,7 @@ sub append_option {
# populate repository with the factory default
my ($opt_key, $opt_index) = split /#/, $full_key, 2;
$self->config->apply(Slic3r::Config->new_from_defaults($opt_key));
$self->config->apply(Slic3r::Config::new_from_defaults_keys($opt_key));
# draw the control
my $optgroup = Slic3r::GUI::ConfigOptionsGroup->new(
@ -300,7 +300,7 @@ sub new {
$self->append_text('Set the shape of your printer\'s bed, then click Next.');
$self->config->apply(Slic3r::Config->new_from_defaults('bed_shape'));
$self->config->apply(Slic3r::Config::new_from_defaults_keys('bed_shape'));
$self->{bed_shape_panel} = my $panel = Slic3r::GUI::BedShapePanel->new($self, $self->config->bed_shape);
$self->{bed_shape_panel}->on_change(sub {
$self->config->set('bed_shape', $self->{bed_shape_panel}->GetValue);

View file

@ -49,7 +49,7 @@ sub new {
my $class = shift;
my ($parent) = @_;
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
$self->{config} = Slic3r::Config->new_from_defaults(qw(
$self->{config} = Slic3r::Config::new_from_defaults_keys(qw(
bed_shape complete_objects extruder_clearance_radius skirts skirt_distance brim_width variable_layer_height
serial_port serial_speed octoprint_host octoprint_apikey
nozzle_diameter single_extruder_multi_material

View file

@ -312,7 +312,7 @@ sub selection_changed {
$config = $self->{model_object}->config;
}
# get default values
my $default_config = Slic3r::Config->new_from_defaults(@opt_keys);
my $default_config = Slic3r::Config::new_from_defaults_keys(@opt_keys);
# append default extruder
push @opt_keys, 'extruder';
@ -490,12 +490,12 @@ sub CanClose {
# validate options before allowing user to dismiss the dialog
# the validate method only works on full configs so we have
# to merge our settings with the default ones
my $config = Slic3r::Config->merge($self->GetParent->GetParent->GetParent->GetParent->GetParent->config, $self->model_object->config);
my $config = $self->GetParent->GetParent->GetParent->GetParent->GetParent->config->clone;
eval {
$config->apply($self->model_object->config);
$config->validate;
};
return 0 if Slic3r::GUI::catch_error($self);
return 1;
return ! Slic3r::GUI::catch_error($self);
}
sub PartsChanged {