From 0275de7f77665644f1d7dc3710cee598b55e04ab Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 14 Feb 2019 11:46:41 +0100 Subject: [PATCH 1/9] Make sure to set the build plate so it's not empty Contributes to CL-1250 --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index a8165ff69c..b641b48235 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -55,6 +55,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): # \param controller - The controller of the model. def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel: model = PrinterOutputModel(controller, len(self.configuration), firmware_version = self.firmware_version) + model.updateBuildplateName(self.build_plate.type) self.updateOutputModel(model) return model From af565aff551e812a11ec40b7eda05790a213b632 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 14 Feb 2019 11:49:43 +0100 Subject: [PATCH 2/9] Clarify if using key or human-readable name This is refering to "glass", not "Glass". According to @lipufei, "name" should denote a human readable/capitalized name. Contributes to CL-1250 --- cura/PrinterOutput/PrinterOutputModel.py | 12 ++++++------ .../src/Cloud/Models/CloudClusterPrinterStatus.py | 2 +- .../UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index 4189b9fcbd..e5f06c832c 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -44,7 +44,7 @@ class PrinterOutputModel(QObject): self._printer_state = "unknown" self._is_preheating = False self._printer_type = "" - self._buildplate_name = "" + self._buildplate = "" self._printer_configuration.extruderConfigurations = [extruder.extruderConfiguration for extruder in self._extruders] @@ -86,12 +86,12 @@ class PrinterOutputModel(QObject): @pyqtProperty(str, notify = buildplateChanged) def buildplate(self) -> str: - return self._buildplate_name + return self._buildplate - def updateBuildplateName(self, buildplate_name: str) -> None: - if self._buildplate_name != buildplate_name: - self._buildplate_name = buildplate_name - self._printer_configuration.buildplateConfiguration = self._buildplate_name + def updateBuildplate(self, buildplate_name: str) -> None: + if self._buildplate != buildplate_name: + self._buildplate = buildplate_name + self._printer_configuration.buildplateConfiguration = self._buildplate self.buildplateChanged.emit() self.configurationChanged.emit() diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index b641b48235..261ab4b389 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -55,7 +55,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): # \param controller - The controller of the model. def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel: model = PrinterOutputModel(controller, len(self.configuration), firmware_version = self.firmware_version) - model.updateBuildplateName(self.build_plate.type) + model.updateBuildplate(self.build_plate.type) self.updateOutputModel(model) return model diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 790d0c430b..4bbb7ddb5f 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -627,7 +627,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): # Do not store the build plate information that comes from connect if the current printer has not build plate information if "build_plate" in data and machine_definition.getMetaDataEntry("has_variant_buildplates", False): - printer.updateBuildplateName(data["build_plate"]["type"]) + printer.updateBuildplate(data["build_plate"]["type"]) if not data["enabled"]: printer.updateState("disabled") else: From 10f84184f34fda5d83ef3fa123df0c77e05825e9 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 14 Feb 2019 11:57:47 +0100 Subject: [PATCH 3/9] Continued clarification on "name" Contributes to CL-1250 --- cura/PrinterOutput/PrinterOutputModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index e5f06c832c..ea8fca5bac 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -88,9 +88,9 @@ class PrinterOutputModel(QObject): def buildplate(self) -> str: return self._buildplate - def updateBuildplate(self, buildplate_name: str) -> None: - if self._buildplate != buildplate_name: - self._buildplate = buildplate_name + def updateBuildplate(self, buildplate: str) -> None: + if self._buildplate != buildplate: + self._buildplate = buildplate self._printer_configuration.buildplateConfiguration = self._buildplate self.buildplateChanged.emit() self.configurationChanged.emit() From 72ce40deba79b498cec694cac65087e3f3a139b3 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 15 Feb 2019 09:36:38 +0100 Subject: [PATCH 4/9] Update buildplate with other props Contributes to CL-1250 --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 261ab4b389..80c5fc72fc 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -55,7 +55,6 @@ class CloudClusterPrinterStatus(BaseCloudModel): # \param controller - The controller of the model. def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel: model = PrinterOutputModel(controller, len(self.configuration), firmware_version = self.firmware_version) - model.updateBuildplate(self.build_plate.type) self.updateOutputModel(model) return model @@ -66,6 +65,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): model.updateName(self.friendly_name) model.updateType(self.machine_variant) model.updateState(self.status if self.enabled else "disabled") + model.updateBuildplate(self.build_plate.type) for configuration, extruder_output, extruder_config in \ zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations): From 5d294a7ff50f88485ad6f51f106a1f79c4ccfc7f Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 15 Feb 2019 10:04:39 +0100 Subject: [PATCH 5/9] Handle self.build_plate = None Contributes to CL-1250 --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 80c5fc72fc..96310b8229 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -65,7 +65,13 @@ class CloudClusterPrinterStatus(BaseCloudModel): model.updateName(self.friendly_name) model.updateType(self.machine_variant) model.updateState(self.status if self.enabled else "disabled") - model.updateBuildplate(self.build_plate.type) + + # Make sure to set the build plate even though we don't use it. Since it's optional, use + # glass as a default + if self.build_plate: + model.updateBuildplate(self.build_plate.type) + else: + model.updateBuildplate("glass") for configuration, extruder_output, extruder_config in \ zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations): From 0be6c9e6d37dad83b7c447bffd439a6a2b2bb1e4 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 15 Feb 2019 10:10:39 +0100 Subject: [PATCH 6/9] Expect to always have a build plate Contributes to CL-1250 --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 96310b8229..78bf0013f1 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -48,7 +48,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): self.maintenance_required = maintenance_required self.firmware_update_status = firmware_update_status self.latest_available_firmware = latest_available_firmware - self.build_plate = self.parseModel(CloudClusterBuildPlate, build_plate) if build_plate else None + self.build_plate = self.parseModel(CloudClusterBuildPlate, build_plate) super().__init__(**kwargs) ## Creates a new output model. @@ -65,13 +65,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): model.updateName(self.friendly_name) model.updateType(self.machine_variant) model.updateState(self.status if self.enabled else "disabled") - - # Make sure to set the build plate even though we don't use it. Since it's optional, use - # glass as a default - if self.build_plate: - model.updateBuildplate(self.build_plate.type) - else: - model.updateBuildplate("glass") + model.updateBuildplate(self.build_plate.type) for configuration, extruder_output, extruder_config in \ zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations): From 4feb53fdf485b7932e9749297dbf6c866d196c63 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 15 Feb 2019 10:12:19 +0100 Subject: [PATCH 7/9] Revert "Expect to always have a build plate" This reverts commit 0be6c9e6d37dad83b7c447bffd439a6a2b2bb1e4. --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 78bf0013f1..96310b8229 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -48,7 +48,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): self.maintenance_required = maintenance_required self.firmware_update_status = firmware_update_status self.latest_available_firmware = latest_available_firmware - self.build_plate = self.parseModel(CloudClusterBuildPlate, build_plate) + self.build_plate = self.parseModel(CloudClusterBuildPlate, build_plate) if build_plate else None super().__init__(**kwargs) ## Creates a new output model. @@ -65,7 +65,13 @@ class CloudClusterPrinterStatus(BaseCloudModel): model.updateName(self.friendly_name) model.updateType(self.machine_variant) model.updateState(self.status if self.enabled else "disabled") - model.updateBuildplate(self.build_plate.type) + + # Make sure to set the build plate even though we don't use it. Since it's optional, use + # glass as a default + if self.build_plate: + model.updateBuildplate(self.build_plate.type) + else: + model.updateBuildplate("glass") for configuration, extruder_output, extruder_config in \ zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations): From f7d86667ed81ffd252889802516ed26ad0e220f1 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 15 Feb 2019 10:14:14 +0100 Subject: [PATCH 8/9] Simplify code a bit Contributes to CL-1250 --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 96310b8229..6193fd0c26 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -65,13 +65,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): model.updateName(self.friendly_name) model.updateType(self.machine_variant) model.updateState(self.status if self.enabled else "disabled") - - # Make sure to set the build plate even though we don't use it. Since it's optional, use - # glass as a default - if self.build_plate: - model.updateBuildplate(self.build_plate.type) - else: - model.updateBuildplate("glass") + model.updateBuildplate(self.build_plate.type or "glass") for configuration, extruder_output, extruder_config in \ zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations): From 0a945b8ba5fc726a7695826ea58624cab8948f28 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 15 Feb 2019 10:18:47 +0100 Subject: [PATCH 9/9] Code style Contributes to CL-1250 --- .../src/Cloud/Models/CloudClusterPrinterStatus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py index 6193fd0c26..bd3e482bde 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterStatus.py @@ -65,7 +65,7 @@ class CloudClusterPrinterStatus(BaseCloudModel): model.updateName(self.friendly_name) model.updateType(self.machine_variant) model.updateState(self.status if self.enabled else "disabled") - model.updateBuildplate(self.build_plate.type or "glass") + model.updateBuildplate(self.build_plate.type if self.build_plate else "glass") for configuration, extruder_output, extruder_config in \ zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations):