From f987e6d977d8108ab6225b6d3a6df401d89a57b8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 21 Nov 2017 16:59:17 +0100 Subject: [PATCH] Functionality properties (canPause, canPreHeatBed, etc) are now in the Controller. It's actually up to the controller to say something about this, so this location makes more sense CL-541 --- cura/PrinterOutput/PrinterOutputController.py | 5 ++++- cura/PrinterOutput/PrinterOutputModel.py | 22 ++++++++++--------- resources/qml/PrinterOutput/HeatedBedBox.qml | 4 ++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/cura/PrinterOutput/PrinterOutputController.py b/cura/PrinterOutput/PrinterOutputController.py index 9f9a26a2a5..525c8db102 100644 --- a/cura/PrinterOutput/PrinterOutputController.py +++ b/cura/PrinterOutput/PrinterOutputController.py @@ -9,7 +9,10 @@ if MYPY: class PrinterOutputController: def __init__(self): - pass + self.can_pause = True + self.can_abort = True + self.can_pre_heat_bed = True + self.can_control_manually = True def setTargetHotendTemperature(self, printer: "PrinterOutputModel", extruder: "ExtruderOuputModel", temperature: int): # TODO: implement diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index 12c2b4fe58..97f5c69723 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -35,12 +35,6 @@ class PrinterOutputModel(QObject): self._printer_state = "unknown" - # Features of the printer; - self._can_pause = True - self._can_abort = True - self._can_pre_heat_bed = True - self._can_control_manually = True - @pyqtProperty(str, notify=keyChanged) def key(self): return self._key @@ -175,19 +169,27 @@ class PrinterOutputModel(QObject): # Does the printer support pre-heating the bed at all @pyqtProperty(bool, constant=True) def canPreHeatBed(self): - return self._can_pre_heat_bed + if self._controller: + return self._controller.can_pre_heat_bed + return False # Does the printer support pause at all @pyqtProperty(bool, constant=True) def canPause(self): - return self._can_pause + if self._controller: + return self.can_pause + return False # Does the printer support abort at all @pyqtProperty(bool, constant=True) def canAbort(self): - return self._can_abort + if self._controller: + return self.can_abort + return False # Does the printer support manual control at all @pyqtProperty(bool, constant=True) def canControlManually(self): - return self._can_control_manually + if self._controller: + return self.can_control_manually + return False diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 6ff48df6a2..de34fe5943 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -229,6 +229,10 @@ Item property var endTime: new Date() //Set initial endTime to be the current date, so that the endTime has initially already passed and the timer text becomes invisible if you were to update. function update() { + if(printerModel != null && !printerModel.canPreHeatBed) + { + return // Nothing to do, printer cant preheat at all! + } preheatCountdown.text = "" if (printerModel != null) {