Use new method of setting active stage when needing to switch to monitor

This commit is contained in:
ChrisTerBeke 2017-12-07 11:56:52 +01:00
parent acbef72b68
commit 9bf954643c
4 changed files with 6 additions and 7 deletions

View file

@ -391,7 +391,6 @@ class CuraApplication(QtApplication):
def needToShowUserAgreement(self): def needToShowUserAgreement(self):
return self._need_to_show_user_agreement return self._need_to_show_user_agreement
def setNeedToShowUserAgreement(self, set_value = True): def setNeedToShowUserAgreement(self, set_value = True):
self._need_to_show_user_agreement = set_value self._need_to_show_user_agreement = set_value

View file

@ -698,7 +698,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
if self._reply: if self._reply:
self._reply.abort() self._reply.abort()
self._stage = OutputStage.ready self._stage = OutputStage.ready
Application.getInstance().showPrintMonitor.emit(False) Application.getInstance().getController().setActiveStage("PrepareStage")
@pyqtSlot(int, result=str) @pyqtSlot(int, result=str)
def formatDuration(self, seconds): def formatDuration(self, seconds):

View file

@ -672,7 +672,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
Logger.log("d", "Attempting to perform an action without authentication for printer %s. Auth state is %s", self._key, self._authentication_state) Logger.log("d", "Attempting to perform an action without authentication for printer %s. Auth state is %s", self._key, self._authentication_state)
return return
Application.getInstance().showPrintMonitor.emit(True) Application.getInstance().getController().setActiveStage("MonitorStage")
self._print_finished = True self._print_finished = True
self.writeStarted.emit(self) self.writeStarted.emit(self)
self._gcode = getattr(Application.getInstance().getController().getScene(), "gcode_list") self._gcode = getattr(Application.getInstance().getController().getScene(), "gcode_list")
@ -767,7 +767,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
if button == QMessageBox.Yes: if button == QMessageBox.Yes:
self.startPrint() self.startPrint()
else: else:
Application.getInstance().showPrintMonitor.emit(False) Application.getInstance().getController().setActiveStage("PrepareStage")
# For some unknown reason Cura on OSX will hang if we do the call back code # For some unknown reason Cura on OSX will hang if we do the call back code
# immediately without first returning and leaving QML's event system. # immediately without first returning and leaving QML's event system.
QTimer.singleShot(100, delayedCallback) QTimer.singleShot(100, delayedCallback)
@ -850,7 +850,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._write_finished = True # post_reply does not always exist, so make sure we unblock writing self._write_finished = True # post_reply does not always exist, so make sure we unblock writing
if self._post_reply: if self._post_reply:
self._finalizePostReply() self._finalizePostReply()
Application.getInstance().showPrintMonitor.emit(False) Application.getInstance().getController().setActiveStage("PrepareStage")
## Attempt to start a new print. ## Attempt to start a new print.
# This function can fail to actually start a print due to not being authenticated or another print already # This function can fail to actually start a print due to not being authenticated or another print already

View file

@ -490,7 +490,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self.setJobName(file_name) self.setJobName(file_name)
self._print_estimated_time = int(Application.getInstance().getPrintInformation().currentPrintTime.getDisplayString(DurationFormat.Format.Seconds)) self._print_estimated_time = int(Application.getInstance().getPrintInformation().currentPrintTime.getDisplayString(DurationFormat.Format.Seconds))
Application.getInstance().showPrintMonitor.emit(True) Application.getInstance().getController().setActiveStage("MonitorStage")
self.startPrint() self.startPrint()
def _setEndstopState(self, endstop_key, value): def _setEndstopState(self, endstop_key, value):
@ -698,7 +698,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self._is_printing = False self._is_printing = False
self._is_paused = False self._is_paused = False
self._updateJobState("ready") self._updateJobState("ready")
Application.getInstance().showPrintMonitor.emit(False) Application.getInstance().getController().setActiveStage("PrepareStage")
## Check if the process did not encounter an error yet. ## Check if the process did not encounter an error yet.
def hasError(self): def hasError(self):