Fix: Pressing 'cancel' button during compressing the print job should show "Prepare" page

CURA-4960
This commit is contained in:
Aleksei S 2018-03-07 11:34:10 +01:00
parent 507de9c22c
commit 23653d7357

View file

@ -93,13 +93,15 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._gcode = gcode_list self._gcode = gcode_list
is_job_sent = True
if len(self._printers) > 1: if len(self._printers) > 1:
self._spawnPrinterSelectionDialog() self._spawnPrinterSelectionDialog()
else: else:
self.sendPrintJob() is_job_sent = self.sendPrintJob()
# Notify the UI that a switch to the print monitor should happen # Notify the UI that a switch to the print monitor should happen
Application.getInstance().getController().setActiveStage("MonitorStage") if is_job_sent:
Application.getInstance().getController().setActiveStage("MonitorStage")
def _spawnPrinterSelectionDialog(self): def _spawnPrinterSelectionDialog(self):
if self._printer_selection_dialog is None: if self._printer_selection_dialog is None:
@ -121,7 +123,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
i18n_catalog.i18nc("@info:status", i18n_catalog.i18nc("@info:status",
"Sending new jobs (temporarily) blocked, still sending the previous print job.")) "Sending new jobs (temporarily) blocked, still sending the previous print job."))
self._error_message.show() self._error_message.show()
return return False
self._sending_gcode = True self._sending_gcode = True
@ -134,7 +136,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
compressed_gcode = self._compressGCode() compressed_gcode = self._compressGCode()
if compressed_gcode is None: if compressed_gcode is None:
# Abort was called. # Abort was called.
return return False
parts = [] parts = []
@ -152,6 +154,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._latest_reply_handler = self.postFormWithParts("print_jobs/", parts, onFinished=self._onPostPrintJobFinished, onProgress=self._onUploadPrintJobProgress) self._latest_reply_handler = self.postFormWithParts("print_jobs/", parts, onFinished=self._onPostPrintJobFinished, onProgress=self._onUploadPrintJobProgress)
return True
@pyqtProperty(QObject, notify=activePrinterChanged) @pyqtProperty(QObject, notify=activePrinterChanged)
def activePrinter(self) -> Optional["PrinterOutputModel"]: def activePrinter(self) -> Optional["PrinterOutputModel"]:
return self._active_printer return self._active_printer