diff options
author | Jaime van Kessel <nallath@gmail.com> | 2022-01-03 17:32:58 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2022-01-03 17:32:58 +0300 |
commit | f11d728c6ba8fb31837145ab808d99b738deddd1 (patch) | |
tree | acc07493639344a135816a0b46a0f3bbb76178df /plugins/UM3NetworkPrinting | |
parent | cefffe62cd617b419e77dd6e3a6f2bfb94516540 (diff) | |
parent | 58c9522d78fa2279b689b7f38314c5c978f47272 (diff) |
Merge branch 'master' of github.com:Ultimaker/Cura into replace_controls_1_for_controls_2
Diffstat (limited to 'plugins/UM3NetworkPrinting')
4 files changed, 33 insertions, 6 deletions
diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index be5efe6e76..4f4fd1c027 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -66,6 +66,8 @@ Item switch (printJob.state) { case "wait_cleanup": + // This hack was removed previously. Then we found out that we don't get back 'aborted_wait_cleanup' + // for the UM2+C it seems. Will communicate this to other teams, in the mean time, put this back. if (printJob.timeTotal > printJob.timeElapsed) { return catalog.i18nc("@label:status", "Aborted"); @@ -81,6 +83,20 @@ Item return catalog.i18nc("@label:status", "Aborting..."); case "aborted": // NOTE: Unused, see above return catalog.i18nc("@label:status", "Aborted"); + case "aborted_post_print": + return catalog.i18nc("@label:status", "Aborted"); + case "aborted_wait_user_action": + return catalog.i18nc("@label:status", "Aborted"); + case "aborted_wait_cleanup": + return catalog.i18nc("@label:status", "Aborted"); + case "failed": + return catalog.i18nc("@label:status", "Failed"); + case "failed_post_print": + return catalog.i18nc("@label:status", "Failed"); + case "failed_wait_user_action": + return catalog.i18nc("@label:status", "Failed"); + case "failed_wait_cleanup": + return catalog.i18nc("@label:status", "Failed"); case "pausing": return catalog.i18nc("@label:status", "Pausing..."); case "paused": diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index 5b1844e7cb..8eecafd49c 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -19,7 +19,7 @@ from cura.CuraApplication import CuraApplication from cura.Settings.CuraContainerRegistry import CuraContainerRegistry # To update printer metadata with information received about cloud printers. from cura.Settings.CuraStackBuilder import CuraStackBuilder from cura.Settings.GlobalStack import GlobalStack -from cura.UltimakerCloud.UltimakerCloudConstants import META_UM_LINKED_TO_ACCOUNT +from cura.UltimakerCloud.UltimakerCloudConstants import META_CAPABILITIES, META_UM_LINKED_TO_ACCOUNT from .CloudApiClient import CloudApiClient from .CloudOutputDevice import CloudOutputDevice from ..Models.Http.CloudClusterResponse import CloudClusterResponse @@ -128,6 +128,8 @@ class CloudOutputDeviceManager: # to the current account if not parseBool(self._um_cloud_printers[device_id].getMetaDataEntry(META_UM_LINKED_TO_ACCOUNT, "true")): self._um_cloud_printers[device_id].setMetaDataEntry(META_UM_LINKED_TO_ACCOUNT, True) + if not self._um_cloud_printers[device_id].getMetaDataEntry(META_CAPABILITIES, None): + self._um_cloud_printers[device_id].setMetaDataEntry(META_CAPABILITIES, ",".join(cluster_data.capabilities)) self._onDevicesDiscovered(new_clusters) self._updateOnlinePrinters(all_clusters) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py index 1af3d83964..ce6dd1de4d 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py @@ -37,7 +37,7 @@ class CloudClusterResponse(BaseModel): self.friendly_name = friendly_name self.printer_type = printer_type self.printer_count = printer_count - self.capabilities = capabilities + self.capabilities = capabilities if capabilities is not None else [] super().__init__(**kwargs) # Validates the model, raising an exception if the model is invalid. @@ -45,3 +45,10 @@ class CloudClusterResponse(BaseModel): super().validate() if not self.cluster_id: raise ValueError("cluster_id is required on CloudCluster") + + def __repr__(self) -> str: + """ + Convenience function for printing when debugging. + :return: A human-readable representation of the data in this object. + """ + return str({k: v for k, v in self.__dict__.items() if k in {"cluster_id", "host_guid", "host_name", "status", "is_online", "host_version", "host_internal_ip", "friendly_name", "printer_type", "printer_count", "capabilities"}}) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrintJobStatus.py b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrintJobStatus.py index 987ca9fab1..6873582074 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrintJobStatus.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrintJobStatus.py @@ -40,7 +40,7 @@ class ClusterPrintJobStatus(BaseModel): configuration_changes_required: List[ Union[Dict[str, Any], ClusterPrintJobConfigurationChange]] = None, build_plate: Union[Dict[str, Any], ClusterBuildPlate] = None, - compatible_machine_families: List[str] = None, + compatible_machine_families: Optional[List[str]] = None, impediments_to_printing: List[Union[Dict[str, Any], ClusterPrintJobImpediment]] = None, preview_url: Optional[str] = None, **kwargs) -> None: @@ -97,7 +97,7 @@ class ClusterPrintJobStatus(BaseModel): configuration_changes_required) \ if configuration_changes_required else [] self.build_plate = self.parseModel(ClusterBuildPlate, build_plate) if build_plate else None - self.compatible_machine_families = compatible_machine_families if compatible_machine_families else [] + self.compatible_machine_families = compatible_machine_families if compatible_machine_families is not None else [] self.impediments_to_printing = self.parseModels(ClusterPrintJobImpediment, impediments_to_printing) \ if impediments_to_printing else [] @@ -130,8 +130,10 @@ class ClusterPrintJobStatus(BaseModel): model.updateConfiguration(self._createConfigurationModel()) model.updateTimeTotal(self.time_total) - model.updateTimeElapsed(self.time_elapsed) - model.updateOwner(self.owner) + if self.time_elapsed is not None: + model.updateTimeElapsed(self.time_elapsed) + if self.owner is not None: + model.updateOwner(self.owner) model.updateState(self.status) model.setCompatibleMachineFamilies(self.compatible_machine_families) |