Validate configuration before saving from GUI

This commit is contained in:
Alessandro Ranellucci 2012-02-06 16:52:11 +01:00
parent a0250b1606
commit ddb0330fc1

View File

@ -227,6 +227,13 @@ sub do_slice {
sub save_config {
my $self = shift;
my $process_dialog;
eval {
# validate configuration
Slic3r::Config->validate;
};
$self->catch_error(sub { $process_dialog->Destroy if $process_dialog }) and return;
my $dir = $last_config ? dirname($last_config) : $last_config_dir || $last_skein_dir || "";
my $filename = $last_config ? basename($last_config) : "config.ini";
my $dlg = Wx::FileDialog->new($self, 'Save configuration as:', $dir, $filename,
@ -263,7 +270,9 @@ sub catch_error {
if (my $err = $@) {
$cb->() if $cb;
Wx::MessageDialog->new($self, $err, 'Error', wxOK | wxICON_ERROR)->ShowModal;
return 1;
}
return 0;
}
sub catch_warning {