Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-09-14 10:28:00 +0300
committerbubnikv <bubnikv@gmail.com>2018-09-14 10:28:00 +0300
commit9d9e4a0f7b2d9d3440c2a05bc65b2cab707d148a (patch)
treee57a7cb171afe5efa6381a73ad02dcbce3050826 /lib
parentbb70ad609025a259f35f4f21e2fc9587c7a3fc2d (diff)
WIP: Background processing.
Diffstat (limited to 'lib')
-rw-r--r--lib/Slic3r/GUI/Plater.pm29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm
index 4d70076ef..de2657894 100644
--- a/lib/Slic3r/GUI/Plater.pm
+++ b/lib/Slic3r/GUI/Plater.pm
@@ -1417,9 +1417,9 @@ sub start_background_process {
# Stop the background processing
sub stop_background_process {
my ($self) = @_;
+ $self->{background_slicing_process}->stop();
$self->{toolpaths2D}->reload_print if $self->{canvas3D};
$self->{preview3D}->reload_print if $self->{preview3D};
- $self->schedule_background_process;
}
# Called by the "Slice now" button, which is visible only if the background processing is disabled.
@@ -1467,6 +1467,7 @@ sub export_gcode {
eval {
# this will throw errors if config is not valid
$config->validate;
+ #FIXME it shall use the background processing!
$self->{print}->apply_config($config);
$self->{print}->validate;
};
@@ -1508,6 +1509,8 @@ sub export_gcode {
# this updates buttons status
$self->object_list_changed;
});
+
+ $self->{background_slicing_process}->set_output_path($self->{export_gcode_output_file});
# start background process, whose completion event handler
# will detect $self->{export_gcode_output_file} and proceed with export
@@ -1557,7 +1560,10 @@ sub on_process_completed {
my $message;
my $send_gcode = 0;
my $do_print = 0;
- if ($result) {
+# print "Process completed, message: ", $message, "\n";
+ if (defined($result)) {
+ $message = L("Export failed");
+ } else {
# G-code file exported successfully.
if ($self->{print_file}) {
$message = L("File added to print queue");
@@ -1565,14 +1571,13 @@ sub on_process_completed {
} elsif ($self->{send_gcode_file}) {
$message = L("Sending G-code file to the Printer Host ...");
$send_gcode = 1;
- } else {
+ } elsif (defined $self->{export_gcode_output_file}) {
$message = L("G-code file exported to ") . $self->{export_gcode_output_file};
+ } else {
+ $message = L("Slicing complete");
}
- } else {
- $message = L("Export failed");
}
$self->{export_gcode_output_file} = undef;
- $self->statusbar->SetStatusText($message);
wxTheApp->notify($message);
$self->do_print if $do_print;
@@ -1580,14 +1585,20 @@ sub on_process_completed {
# Send $self->{send_gcode_file} to OctoPrint.
if ($send_gcode) {
my $host = Slic3r::PrintHost::get_print_host($self->{config});
-
if ($host->send_gcode($self->{send_gcode_file})) {
- $self->statusbar->SetStatusText(L("Upload to host finished."));
+ $message = L("Upload to host finished.");
} else {
- $self->statusbar->SetStatusText("");
+ $message = "";
}
}
+ # As of now, the BackgroundProcessing thread posts status bar update messages to a queue on the MainFrame.pm,
+ # but the "Processing finished" message is posted to this window.
+ # Delay the following status bar update, so it will be called later than what is received by MainFrame.pm.
+ wxTheApp->CallAfter(sub {
+ $self->statusbar->SetStatusText($message);
+ });
+
$self->{print_file} = undef;
$self->{send_gcode_file} = undef;
$self->print_info_box_show(1);