Add enabled state to printer, so that it can be displayed.

This ensures that if a printer is set to "Not available", that the interface can correctly show it

CL-896
This commit is contained in:
Jaime van Kessel 2018-09-04 13:27:17 +02:00
parent 3969463758
commit dd778f0450
4 changed files with 25 additions and 1 deletions

View file

@ -26,6 +26,7 @@ class PrinterOutputModel(QObject):
buildplateChanged = pyqtSignal()
cameraChanged = pyqtSignal()
configurationChanged = pyqtSignal()
enabledChanged = pyqtSignal()
def __init__(self, output_controller: "PrinterOutputController", number_of_extruders: int = 1, parent=None, firmware_version = "") -> None:
super().__init__(parent)
@ -43,12 +44,22 @@ class PrinterOutputModel(QObject):
self._is_preheating = False
self._printer_type = ""
self._buildplate_name = None
self._enabled = True
self._printer_configuration.extruderConfigurations = [extruder.extruderConfiguration for extruder in
self._extruders]
self._camera = None
@pyqtProperty(bool, notify=enabledChanged)
def enabled(self) -> bool:
return self._enabled
def updateEnabled(self, enabled: bool) -> None:
if self._enabled != enabled:
self._enabled = enabled
self.enabledChanged.emit()
@pyqtProperty(str, constant = True)
def firmwareVersion(self):
return self._firmware_version