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

Reset sync status when closing and re-opening sync window

Otherwise when you want to sync again, it'll just say that you're done. Not what a user would expect, I reckon.

Contributes to issue CURA-8609.
Ghostkeeper 3 лет назад
Родитель
Сommit
273e933145

+ 3 - 1
cura/Machines/Models/MaterialManagementModel.py

@@ -272,6 +272,8 @@ class MaterialManagementModel(QObject):
         """
         Opens the window to sync all materials.
         """
+        self._material_sync.reset()
+
         if self._material_sync.sync_all_dialog is None:
             qml_path = Resources.getPath(cura.CuraApplication.CuraApplication.ResourceTypes.QmlFiles, "Preferences", "Materials", "MaterialsSyncDialog.qml")
             self._material_sync.sync_all_dialog = cura.CuraApplication.CuraApplication.getInstance().createQmlComponent(qml_path, {})
@@ -279,4 +281,4 @@ class MaterialManagementModel(QObject):
             return
         self._material_sync.sync_all_dialog.setProperty("syncModel", self._material_sync)
         self._material_sync.sync_all_dialog.setProperty("pageIndex", 0)  # Return to first page.
-        self._material_sync.sync_all_dialog.show()
+        self._material_sync.sync_all_dialog.show()

+ 7 - 1
cura/UltimakerCloud/CloudMaterialSync.py

@@ -191,4 +191,10 @@ class CloudMaterialSync(QObject):
 
     @pyqtProperty("QVariantMap", fset = setPrinterStatus, notify = printerStatusChanged)
     def printerStatus(self) -> Dict[str, str]:
-        return self._printer_status
+        return self._printer_status
+
+    def reset(self) -> None:
+        self.setPrinterStatus({})
+        self.setExportProgress(0.0)
+        self._export_upload_status = "idle"
+        self.exportUploadStatusChanged.emit()