mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 05:07:51 -06:00
Handle read_from_file() exceptions in GUI. #1619
This commit is contained in:
parent
0afee63e84
commit
69ed69179b
2 changed files with 11 additions and 3 deletions
|
@ -384,7 +384,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 $@;
|
||||||
|
|
||||||
for my $i (0 .. $#{$model->objects}) {
|
for my $i (0 .. $#{$model->objects}) {
|
||||||
my $object = Slic3r::GUI::Plater::Object->new(
|
my $object = Slic3r::GUI::Plater::Object->new(
|
||||||
name => $basename,
|
name => $basename,
|
||||||
|
|
|
@ -133,8 +133,11 @@ sub quick_slice {
|
||||||
$Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file);
|
$Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file);
|
||||||
Slic3r::GUI->save_settings;
|
Slic3r::GUI->save_settings;
|
||||||
|
|
||||||
|
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||||
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
|
|
||||||
my $print = $self->init_print;
|
my $print = $self->init_print;
|
||||||
$print->add_model(Slic3r::Model->read_from_file($input_file));
|
$print->add_model($model);
|
||||||
$print->validate;
|
$print->validate;
|
||||||
|
|
||||||
# select output file
|
# select output file
|
||||||
|
@ -364,7 +367,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…
Add table
Add a link
Reference in a new issue