From 925795401f0411526346f4cb037fe8f45a8f1df3 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 10 Aug 2016 17:36:26 +0200 Subject: [PATCH] Fix for abort network printer during pre_print. CURA-2093 --- NetworkPrinterOutputDevice.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NetworkPrinterOutputDevice.py b/NetworkPrinterOutputDevice.py index 60188921f8..e721721474 100644 --- a/NetworkPrinterOutputDevice.py +++ b/NetworkPrinterOutputDevice.py @@ -134,6 +134,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._response_timeout_time = 5 self._not_authenticated_message = None + self._last_command = "" + def _onAuthenticationTimer(self): self._authentication_counter += 1 self._authentication_requested_message.setProgress(self._authentication_counter / self._max_authentication_counter * 100) @@ -356,6 +358,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): return self._camera_image def _setJobState(self, job_state): + self._last_command = job_state url = QUrl("http://" + self._address + self._api_prefix + "print_job/state") put_request = QNetworkRequest(url) put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") @@ -513,12 +516,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # If this happens before the print has reached progress == 1, the print has # been aborted. if state == "none" or state == "": - if self._print_finished: - state = "printing" - else: + if self._last_command == "abort": self.setErrorText(i18n_catalog.i18nc("@label:MonitorStatus", "Aborting print...")) state = "error" - if state == "wait_cleanup" and not self._print_finished: + else: + state = "printing" + if state == "wait_cleanup" and self._last_command == "abort": # Keep showing the "aborted" error state until after the buildplate has been cleaned self.setErrorText(i18n_catalog.i18nc("@label:MonitorStatus", "Print aborted. Please check the printer")) state = "error"