Просмотр исходного кода

Only perform materials-sync-job for capable printers.

part of CURA-8671
Remco Burema 3 лет назад
Родитель
Сommit
1253b41537

+ 8 - 0
cura/PrinterOutput/UploadMaterialsJob.py

@@ -83,6 +83,14 @@ class UploadMaterialsJob(Job):
             host_guid = "*",  # Required metadata field. Otherwise we get a KeyError.
             um_cloud_cluster_id = "*"  # Required metadata field. Otherwise we get a KeyError.
         )
+
+        # Filter out any printer not capable of the 'import_material' capability. Needs FW 7.0.1-RC at the least!
+        self._printer_metadata = [ printer_data for printer_data in self._printer_metadata if (
+                UltimakerCloudConstants.META_CAPABILITIES in printer_data and
+                "import_material" in printer_data[UltimakerCloudConstants.META_CAPABILITIES]
+            )
+        ]
+
         for printer in self._printer_metadata:
             self._printer_sync_status[printer["host_guid"]] = self.PrinterStatus.UPLOADING.value
 

+ 3 - 0
cura/UltimakerCloud/UltimakerCloudConstants.py

@@ -13,6 +13,9 @@ DEFAULT_DIGITAL_FACTORY_URL = "https://digitalfactory.ultimaker.com"  # type: st
 META_UM_LINKED_TO_ACCOUNT = "um_linked_to_account"
 """(bool) Whether a cloud printer is linked to an Ultimaker account"""
 
+META_CAPABILITIES = "capabilities"
+"""(list[str]) a list of capabilities this printer supports"""
+
 try:
     from cura.CuraVersion import CuraCloudAPIRoot  # type: ignore
     if CuraCloudAPIRoot == "":

+ 3 - 1
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, cluster_data.capabilities)
         self._onDevicesDiscovered(new_clusters)
 
         self._updateOnlinePrinters(all_clusters)