mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 22:45:53 +08:00
Fix for abort network printer during pre_print. CURA-2093
This commit is contained in:
parent
7011520845
commit
925795401f
@ -134,6 +134,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
self._response_timeout_time = 5
|
self._response_timeout_time = 5
|
||||||
self._not_authenticated_message = None
|
self._not_authenticated_message = None
|
||||||
|
|
||||||
|
self._last_command = ""
|
||||||
|
|
||||||
def _onAuthenticationTimer(self):
|
def _onAuthenticationTimer(self):
|
||||||
self._authentication_counter += 1
|
self._authentication_counter += 1
|
||||||
self._authentication_requested_message.setProgress(self._authentication_counter / self._max_authentication_counter * 100)
|
self._authentication_requested_message.setProgress(self._authentication_counter / self._max_authentication_counter * 100)
|
||||||
@ -356,6 +358,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
return self._camera_image
|
return self._camera_image
|
||||||
|
|
||||||
def _setJobState(self, job_state):
|
def _setJobState(self, job_state):
|
||||||
|
self._last_command = job_state
|
||||||
url = QUrl("http://" + self._address + self._api_prefix + "print_job/state")
|
url = QUrl("http://" + self._address + self._api_prefix + "print_job/state")
|
||||||
put_request = QNetworkRequest(url)
|
put_request = QNetworkRequest(url)
|
||||||
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
|
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
|
# If this happens before the print has reached progress == 1, the print has
|
||||||
# been aborted.
|
# been aborted.
|
||||||
if state == "none" or state == "":
|
if state == "none" or state == "":
|
||||||
if self._print_finished:
|
if self._last_command == "abort":
|
||||||
state = "printing"
|
|
||||||
else:
|
|
||||||
self.setErrorText(i18n_catalog.i18nc("@label:MonitorStatus", "Aborting print..."))
|
self.setErrorText(i18n_catalog.i18nc("@label:MonitorStatus", "Aborting print..."))
|
||||||
state = "error"
|
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
|
# 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"))
|
self.setErrorText(i18n_catalog.i18nc("@label:MonitorStatus", "Print aborted. Please check the printer"))
|
||||||
state = "error"
|
state = "error"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user