mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Added canAbort & canPause feature to PrinterOutputDevice
This commit is contained in:
parent
20ffb0cd6d
commit
8683275d4f
2 changed files with 14 additions and 2 deletions
|
@ -71,6 +71,8 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._control_item = None
|
self._control_item = None
|
||||||
|
|
||||||
self._qml_context = None
|
self._qml_context = None
|
||||||
|
self._can_pause = True
|
||||||
|
self._can_abort = True
|
||||||
|
|
||||||
def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None):
|
def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None):
|
||||||
raise NotImplementedError("requestWrite needs to be implemented")
|
raise NotImplementedError("requestWrite needs to be implemented")
|
||||||
|
@ -126,6 +128,16 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# Signal to be emitted when some drastic change occurs in the remaining time (not when the time just passes on normally).
|
# Signal to be emitted when some drastic change occurs in the remaining time (not when the time just passes on normally).
|
||||||
preheatBedRemainingTimeChanged = pyqtSignal()
|
preheatBedRemainingTimeChanged = pyqtSignal()
|
||||||
|
|
||||||
|
# Does the printer support pause at all
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def canPause(self):
|
||||||
|
return self._can_pause
|
||||||
|
|
||||||
|
# Does the printer support abort at all
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def canAbort(self):
|
||||||
|
return self._can_abort
|
||||||
|
|
||||||
@pyqtProperty(QObject, constant=True)
|
@pyqtProperty(QObject, constant=True)
|
||||||
def monitorItem(self):
|
def monitorItem(self):
|
||||||
# Note that we specifically only check if the monitor component is created.
|
# Note that we specifically only check if the monitor component is created.
|
||||||
|
|
|
@ -220,7 +220,7 @@ Item
|
||||||
property bool userClicked: false
|
property bool userClicked: false
|
||||||
property string lastJobState: ""
|
property string lastJobState: ""
|
||||||
|
|
||||||
visible: printerConnected
|
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].canPause
|
||||||
enabled: (!userClicked) && printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
enabled: (!userClicked) && printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||||
(["paused", "printing"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
(["paused", "printing"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ Item
|
||||||
{
|
{
|
||||||
id: abortButton
|
id: abortButton
|
||||||
|
|
||||||
visible: printerConnected
|
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].canAbort
|
||||||
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||||
(["paused", "printing", "pre_print"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
(["paused", "printing", "pre_print"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue