Display validation errors in status bar when background processing couldn't generate toolpaths

This commit is contained in:
Alessandro Ranellucci 2014-12-01 00:15:45 +01:00
parent 04bcb410a9
commit c9e896c669

View File

@ -853,7 +853,10 @@ sub start_background_process {
$self->GetFrame->config->validate; $self->GetFrame->config->validate;
$self->{print}->validate; $self->{print}->validate;
}; };
return if $@; if ($@) {
$self->statusbar->SetStatusText($@);
return;
}
# apply extra variables # apply extra variables
{ {
@ -869,9 +872,9 @@ sub start_background_process {
}; };
if ($@) { if ($@) {
Slic3r::debugf "Discarding background process error: $@\n"; Slic3r::debugf "Discarding background process error: $@\n";
Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $PROCESS_COMPLETED_EVENT, 0)); Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $PROCESS_COMPLETED_EVENT, $@));
} else { } else {
Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $PROCESS_COMPLETED_EVENT, 1)); Wx::PostEvent($self, Wx::PlThreadEvent->new(-1, $PROCESS_COMPLETED_EVENT, undef));
} }
Slic3r::thread_cleanup(); Slic3r::thread_cleanup();
}); });
@ -993,17 +996,17 @@ sub export_gcode {
# This gets called only if we have threads. # This gets called only if we have threads.
sub on_process_completed { sub on_process_completed {
my ($self, $result) = @_; my ($self, $error) = @_;
$self->statusbar->SetCancelCallback(undef); $self->statusbar->SetCancelCallback(undef);
$self->statusbar->StopBusy; $self->statusbar->StopBusy;
$self->statusbar->SetStatusText(""); $self->statusbar->SetStatusText($error // "");
Slic3r::debugf "Background processing completed.\n"; Slic3r::debugf "Background processing completed.\n";
$self->{process_thread}->detach if $self->{process_thread}; $self->{process_thread}->detach if $self->{process_thread};
$self->{process_thread} = undef; $self->{process_thread} = undef;
return if !$result; return if $error;
$self->{toolpaths2D}->reload_print; $self->{toolpaths2D}->reload_print;
# if we have an export filename, start a new thread for exporting G-code # if we have an export filename, start a new thread for exporting G-code