Don't die when config has unknown options. #108

This commit is contained in:
Alessandro Ranellucci 2011-12-10 10:39:07 +01:00
parent c957c27367
commit 0ebd8eb8a9
2 changed files with 12 additions and 6 deletions

View file

@ -159,11 +159,7 @@ sub do_slice {
},
);
{
local $SIG{__WARN__} = sub {
my $message = shift;
Wx::MessageDialog->new($self, $message, 'Warning',
wxOK | wxICON_WARNING)->ShowModal;
};
local $SIG{__WARN__} = $self->catch_warning;
$skein->go;
}
$process_dialog->Destroy;
@ -205,6 +201,7 @@ sub load_config {
my ($file) = $dlg->GetPaths;
$last_dir = dirname($file);
eval {
local $SIG{__WARN__} = $self->catch_warning;
Slic3r::Config->load($file);
};
$self->catch_error();
@ -220,4 +217,12 @@ sub catch_error {
}
}
sub catch_warning {
my ($self) = @_;
return sub {
my $message = shift;
Wx::MessageDialog->new($self, $message, 'Warning', wxOK | wxICON_WARNING)->ShowModal;
};
};
1;