mirror of https://github.com/vitalif/Slic3r
Handle read_from_file() exceptions in GUI. #1619
parent
21ca1901c1
commit
94743d3af0
|
@ -382,7 +382,10 @@ sub load_file {
|
||||||
$process_dialog->Pulse;
|
$process_dialog->Pulse;
|
||||||
|
|
||||||
local $SIG{__WARN__} = Slic3r::GUI::warning_catcher($self);
|
local $SIG{__WARN__} = Slic3r::GUI::warning_catcher($self);
|
||||||
my $model = Slic3r::Model->read_from_file($input_file);
|
|
||||||
|
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||||
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
|
|
||||||
$self->load_model_object($_) for @{$model->objects};
|
$self->load_model_object($_) for @{$model->objects};
|
||||||
|
|
||||||
$process_dialog->Destroy;
|
$process_dialog->Destroy;
|
||||||
|
|
|
@ -134,7 +134,8 @@ sub quick_slice {
|
||||||
Slic3r::GUI->save_settings;
|
Slic3r::GUI->save_settings;
|
||||||
|
|
||||||
my $print = $self->init_print;
|
my $print = $self->init_print;
|
||||||
my $model = Slic3r::Model->read_from_file($input_file);
|
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||||
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
|
|
||||||
if ($model->has_objects_with_no_instances) {
|
if ($model->has_objects_with_no_instances) {
|
||||||
# apply a default position to all objects not having one
|
# apply a default position to all objects not having one
|
||||||
|
@ -374,7 +375,9 @@ sub combine_stls {
|
||||||
$output_file = $dlg->GetPath;
|
$output_file = $dlg->GetPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @models = map Slic3r::Model->read_from_file($_), @input_files;
|
my @models = eval { map Slic3r::Model->read_from_file($_), @input_files };
|
||||||
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
|
|
||||||
my $new_model = Slic3r::Model->new;
|
my $new_model = Slic3r::Model->new;
|
||||||
my $new_object = $new_model->add_object;
|
my $new_object = $new_model->add_object;
|
||||||
for my $m (0 .. $#models) {
|
for my $m (0 .. $#models) {
|
||||||
|
|
Loading…
Reference in New Issue