mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-24 11:21:14 -07:00
Disable print monitor if the printer is not (yet) ready to receive commands
CURA-1851
This commit is contained in:
parent
f3a119f9bb
commit
ed669925ad
4 changed files with 20 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._job_state = ""
|
self._job_state = ""
|
||||||
self._job_name = ""
|
self._job_name = ""
|
||||||
self._error_text = ""
|
self._error_text = ""
|
||||||
|
self._accepts_commands = True
|
||||||
|
|
||||||
def requestWrite(self, node, file_name = None, filter_by_machine = False):
|
def requestWrite(self, node, file_name = None, filter_by_machine = False):
|
||||||
raise NotImplementedError("requestWrite needs to be implemented")
|
raise NotImplementedError("requestWrite needs to be implemented")
|
||||||
|
|
@ -80,6 +81,8 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
|
|
||||||
errorTextChanged = pyqtSignal()
|
errorTextChanged = pyqtSignal()
|
||||||
|
|
||||||
|
acceptsCommandsChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty(str, notify = jobStateChanged)
|
@pyqtProperty(str, notify = jobStateChanged)
|
||||||
def jobState(self):
|
def jobState(self):
|
||||||
return self._job_state
|
return self._job_state
|
||||||
|
|
@ -115,6 +118,16 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._error_text = error_text
|
self._error_text = error_text
|
||||||
self.errorTextChanged.emit()
|
self.errorTextChanged.emit()
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify = acceptsCommandsChanged)
|
||||||
|
def acceptsCommands(self):
|
||||||
|
return self._accepts_commands
|
||||||
|
|
||||||
|
## Set a flag to signal the UI that the printer is not (yet) ready to receive commands
|
||||||
|
def setAcceptsCommands(self, accepts_commands):
|
||||||
|
if self._accepts_commands != accepts_commands:
|
||||||
|
self._accepts_commands = accepts_commands
|
||||||
|
self.acceptsCommandsChanged.emit()
|
||||||
|
|
||||||
## Get the bed temperature of the bed (if any)
|
## Get the bed temperature of the bed (if any)
|
||||||
# This function is "final" (do not re-implement)
|
# This function is "final" (do not re-implement)
|
||||||
# /sa _getBedTemperature implementation function
|
# /sa _getBedTemperature implementation function
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,8 @@ Rectangle
|
||||||
id: abortButton
|
id: abortButton
|
||||||
|
|
||||||
visible: printerConnected
|
visible: printerConnected
|
||||||
enabled: printerConnected && (Cura.MachineManager.printerOutputDevices[0].jobState == "paused" || Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||||
|
(Cura.MachineManager.printerOutputDevices[0].jobState == "paused" || Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
||||||
|
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
anchors.top: progressBar.bottom
|
anchors.top: progressBar.bottom
|
||||||
|
|
@ -173,7 +174,8 @@ Rectangle
|
||||||
id: pauseButton
|
id: pauseButton
|
||||||
|
|
||||||
visible: printerConnected
|
visible: printerConnected
|
||||||
enabled: printerConnected && (Cura.MachineManager.printerOutputDevices[0].jobState == "paused" || Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands &&
|
||||||
|
(Cura.MachineManager.printerOutputDevices[0].jobState == "paused" || Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
||||||
|
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
anchors.top: progressBar.bottom
|
anchors.top: progressBar.bottom
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ Column
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: label
|
text: label
|
||||||
color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
width: base.width * 0.4
|
width: base.width * 0.4
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
@ -82,7 +82,7 @@ Column
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: value
|
text: value
|
||||||
color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ Rectangle
|
||||||
|
|
||||||
// Is there an output device for this printer?
|
// Is there an output device for this printer?
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||||
|
|
||||||
color: UM.Theme.getColor("sidebar");
|
color: UM.Theme.getColor("sidebar");
|
||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue