Fixed regression in dirty settings

This commit is contained in:
Alessandro Ranellucci 2017-05-26 19:04:51 +02:00
parent 846478520f
commit a1b0246710
2 changed files with 23 additions and 4 deletions

View File

@ -388,6 +388,12 @@ sub new {
$self->load_presets;
$self->config_changed;
# Reload the open tab if any
if (my $print_tab = $self->GetFrame->{preset_editor_tabs}{print}) {
$print_tab->load_presets;
$print_tab->reload_preset;
}
});
$o->can_add(0);
$o->can_delete(1);
@ -782,6 +788,13 @@ sub show_preset_editor {
$preset_editor->select_preset_by_name($presets[$i // 0]->name);
$preset_editor->on_value_change(sub {
# Re-load the presets in order to toggle the (modified) suffix
$self->load_presets;
# Update shortcuts
$self->_on_select_preset($group);
# Use the new config wherever we actually use its contents
$self->config_changed;
});
$preset_editor->on_select_preset(sub {

View File

@ -208,9 +208,7 @@ sub _on_select_preset {
# prompted and chose to discard changes.
$self->load_presets;
$preset->load_config if !$preset->_loaded;
$self->config->clear;
$self->config->apply($preset->dirty_config);
$self->reload_preset;
eval {
local $SIG{__WARN__} = Slic3r::GUI::warning_catcher($self);
@ -220,7 +218,6 @@ sub _on_select_preset {
$self->_update;
$self->on_preset_loaded;
$self->reload_config;
};
if ($@) {
$@ = "I was unable to load the selected config file: $@";
@ -247,6 +244,15 @@ sub add_options_page {
return $page;
}
sub reload_preset {
my ($self) = @_;
$self->current_preset->load_config if !$self->current_preset->_loaded;
$self->config->clear;
$self->config->apply($self->current_preset->dirty_config);
$self->reload_config;
}
sub reload_config {
my $self = shift;