mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Added property to indicate if output device accepts commands
Instead of how this was previously done, it's now tied to the auth state. CL-541
This commit is contained in:
parent
0b91112d72
commit
1c2c4d4163
3 changed files with 25 additions and 0 deletions
|
@ -34,6 +34,7 @@ i18n_catalog = i18nCatalog("cura")
|
|||
class PrinterOutputDevice(QObject, OutputDevice):
|
||||
printersChanged = pyqtSignal()
|
||||
connectionStateChanged = pyqtSignal(str)
|
||||
acceptsCommandsChanged = pyqtSignal()
|
||||
|
||||
def __init__(self, device_id, parent = None):
|
||||
super().__init__(device_id = device_id, parent = parent)
|
||||
|
@ -49,6 +50,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
|||
self._control_item = None
|
||||
|
||||
self._qml_context = None
|
||||
self._accepts_commands = False
|
||||
|
||||
self._update_timer = QTimer()
|
||||
self._update_timer.setInterval(2000) # TODO; Add preference for update interval
|
||||
|
@ -152,6 +154,17 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
|||
def __del__(self):
|
||||
self.close()
|
||||
|
||||
@pyqtProperty(bool, 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()
|
||||
|
||||
|
||||
## The current processing state of the backend.
|
||||
class ConnectionState(IntEnum):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue