diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2014-12-27 16:38:06 +0300 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2014-12-27 16:38:06 +0300 |
commit | 53e8699765b62b4dbd0c6ee101d61d96dceabbb0 (patch) | |
tree | df77e563c463bb8db72e88b0bebbad86ea078f06 | |
parent | bbb47e087a2cc58ce6816c7bc2687efc294eaede (diff) |
Prepend option category in the unsaved changes dialog
-rw-r--r-- | lib/Slic3r/GUI/Tab.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index ad32fc96a..398aecac2 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -205,9 +205,18 @@ sub on_select_preset { if ($self->is_dirty) { my $old_preset = $self->get_current_preset; my $name = $old_preset->default ? 'Default preset' : "Preset \"" . $old_preset->name . "\""; - my $changes = join "\n", - map { "- " . ($Slic3r::Config::Options->{$_}{full_label} // $Slic3r::Config::Options->{$_}{label}) } - @{$self->dirty_options}; + + my @option_names = (); + foreach my $opt_key (@{$self->dirty_options}) { + my $opt = $Slic3r::Config::Options->{$opt_key}; + my $name = $opt->{full_label} // $opt->{label}; + if ($opt->{category}) { + $name = $opt->{category} . " > $name"; + } + push @option_names, $name; + } + + my $changes = join "\n", map "- $_", @option_names; my $confirm = Wx::MessageDialog->new($self, "$name has unsaved changes:\n$changes\n\nDiscard changes and continue anyway?", 'Unsaved Changes', wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); if ($confirm->ShowModal == wxID_NO) { |