CURA-4870 Add information about the buildplate in the printer output

model so it can be used to show the buildplate name in the configuration
list.
This commit is contained in:
Diego Prado Gesto 2018-03-07 13:57:13 +01:00
parent 0beee79c3a
commit 97740123fa
5 changed files with 44 additions and 20 deletions

View file

@ -23,6 +23,7 @@ class PrinterOutputModel(QObject):
headPositionChanged = pyqtSignal()
keyChanged = pyqtSignal()
typeChanged = pyqtSignal()
buildplateChanged = pyqtSignal()
cameraChanged = pyqtSignal()
configurationChanged = pyqtSignal()
@ -41,6 +42,7 @@ class PrinterOutputModel(QObject):
self._printer_state = "unknown"
self._is_preheating = False
self._type = ""
self._buildplate_name = None
# Update the printer configuration every time any of the extruders changes its configuration
for extruder in self._extruders:
extruder.extruderConfigurationChanged.connect(self._updatePrinterConfiguration)
@ -78,6 +80,15 @@ class PrinterOutputModel(QObject):
self._type = type
self.typeChanged.emit()
@pyqtProperty(str, notify = buildplateChanged)
def buildplate(self):
return self._buildplate_name
def updateBuildplate(self, buildplate_name):
if self._buildplate_name != buildplate_name:
self._buildplate_name = buildplate_name
self.buildplateChanged.emit()
@pyqtProperty(str, notify=keyChanged)
def key(self):
return self._key
@ -252,5 +263,5 @@ class PrinterOutputModel(QObject):
def _updatePrinterConfiguration(self):
self._printer_configuration.printerType = self._type
self._printer_configuration.extruderConfigurations = [extruder.extruderConfiguration for extruder in self._extruders]
self._printer_configuration.buildplateConfiguration = None # TODO Add the buildplate information
self._printer_configuration.buildplateConfiguration = self._buildplate_name
self.configurationChanged.emit()