Validate configuration before saving from GUI
This commit is contained in:
parent
a0250b1606
commit
ddb0330fc1
1 changed files with 9 additions and 0 deletions
|
@ -227,6 +227,13 @@ sub do_slice {
|
||||||
sub save_config {
|
sub save_config {
|
||||||
my $self = shift;
|
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 $dir = $last_config ? dirname($last_config) : $last_config_dir || $last_skein_dir || "";
|
||||||
my $filename = $last_config ? basename($last_config) : "config.ini";
|
my $filename = $last_config ? basename($last_config) : "config.ini";
|
||||||
my $dlg = Wx::FileDialog->new($self, 'Save configuration as:', $dir, $filename,
|
my $dlg = Wx::FileDialog->new($self, 'Save configuration as:', $dir, $filename,
|
||||||
|
@ -263,7 +270,9 @@ sub catch_error {
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
$cb->() if $cb;
|
$cb->() if $cb;
|
||||||
Wx::MessageDialog->new($self, $err, 'Error', wxOK | wxICON_ERROR)->ShowModal;
|
Wx::MessageDialog->new($self, $err, 'Error', wxOK | wxICON_ERROR)->ShowModal;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub catch_warning {
|
sub catch_warning {
|
||||||
|
|
Loading…
Add table
Reference in a new issue