From 94a7d6b9416f05f2ad162c1dd6dcfe6d9e7c8cdc Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 25 Aug 2013 22:24:43 +0200 Subject: [PATCH] Validate config before launching the object settings dialog --- lib/Slic3r/GUI/Plater.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 950aa9d11..c58590193 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1094,6 +1094,11 @@ sub object_settings_dialog { ($obj_idx, undef) = $self->selected_object; } + # validate config before opening the settings dialog because + # that dialog can't be closed if validation fails, but user + # can't fix any error which is outside that dialog + return unless $self->validate_config; + my $dlg = Slic3r::GUI::Plater::ObjectSettingsDialog->new($self, object => $self->{objects}[$obj_idx], ); @@ -1167,6 +1172,16 @@ sub selected_object { return ($obj_idx, $self->{objects}[$obj_idx]), } +sub validate_config { + my $self = shift; + + eval { + $self->skeinpanel->config->validate; + }; + return 0 if Slic3r::GUI::catch_error($self); + return 1; +} + sub statusbar { my $self = shift; return $self->skeinpanel->GetParent->{statusbar};