diff options
author | Jaime van Kessel <nallath@gmail.com> | 2021-10-28 10:43:12 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2021-10-28 10:43:12 +0300 |
commit | 8f1cf4a9637276ac8096bae52cba3a776cefa875 (patch) | |
tree | d7bcfba5d5976614ae1d716e40cbe42b375c32dd /cura | |
parent | f47738f5587b5bd9add0d9f2165f6c95962fb050 (diff) |
Move openSYncAllWindow to the right class
CURA-8609
Diffstat (limited to 'cura')
-rw-r--r-- | cura/Machines/Models/MaterialManagementModel.py | 12 | ||||
-rw-r--r-- | cura/UltimakerCloud/CloudMaterialSync.py | 16 |
2 files changed, 18 insertions, 10 deletions
diff --git a/cura/Machines/Models/MaterialManagementModel.py b/cura/Machines/Models/MaterialManagementModel.py index de91703ecf..76b2c5b444 100644 --- a/cura/Machines/Models/MaterialManagementModel.py +++ b/cura/Machines/Models/MaterialManagementModel.py @@ -13,7 +13,7 @@ from UM.Logger import Logger from UM.Resources import Resources # To find QML files. from UM.Signal import postponeSignals, CompressTechnique -import cura.CuraApplication # Imported like this to prevent circular imports. +import cura.CuraApplication # Imported like this to prevent cirmanagecular imports. from cura.Machines.ContainerTree import ContainerTree from cura.Settings.CuraContainerRegistry import CuraContainerRegistry # To find the sets of materials belonging to each other, and currently loaded extruder stacks. from cura.UltimakerCloud.CloudMaterialSync import CloudMaterialSync @@ -330,13 +330,5 @@ class MaterialManagementModel(QObject): """ Opens the window to sync all materials. """ - self._material_sync.reset() + self._material_sync.openSyncAllWindow() - 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, {}) - if self._material_sync.sync_all_dialog is None: # Failed to load QML file. - 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() diff --git a/cura/UltimakerCloud/CloudMaterialSync.py b/cura/UltimakerCloud/CloudMaterialSync.py index 05f65bb822..df5730e7c8 100644 --- a/cura/UltimakerCloud/CloudMaterialSync.py +++ b/cura/UltimakerCloud/CloudMaterialSync.py @@ -7,6 +7,7 @@ from typing import Dict, Optional, TYPE_CHECKING import zipfile # To export all materials in a .zip archive. import cura.CuraApplication # Imported like this to prevent circular imports. +from UM.Resources import Resources from cura.PrinterOutput.UploadMaterialsJob import UploadMaterialsJob, UploadMaterialsError # To export materials to the output printer. from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from UM.i18n import i18nCatalog @@ -42,6 +43,21 @@ class CloudMaterialSync(QObject): self._showSyncNewMaterialsMessage() break + def openSyncAllWindow(self): + + self.reset() + + if self.sync_all_dialog is None: + qml_path = Resources.getPath(cura.CuraApplication.CuraApplication.ResourceTypes.QmlFiles, "Preferences", + "Materials", "MaterialsSyncDialog.qml") + self.sync_all_dialog = cura.CuraApplication.CuraApplication.getInstance().createQmlComponent( + qml_path, {}) + if self.sync_all_dialog is None: # Failed to load QML file. + return + self.sync_all_dialog.setProperty("syncModel", self) + self.sync_all_dialog.setProperty("pageIndex", 0) # Return to first page. + self.sync_all_dialog.show() + def _showSyncNewMaterialsMessage(self) -> None: sync_materials_message = Message( text = catalog.i18nc("@action:button", |