mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Move openSYncAllWindow to the right class
CURA-8609
This commit is contained in:
parent
f47738f558
commit
8f1cf4a963
2 changed files with 18 additions and 10 deletions
|
@ -13,7 +13,7 @@ from UM.Logger import Logger
|
||||||
from UM.Resources import Resources # To find QML files.
|
from UM.Resources import Resources # To find QML files.
|
||||||
from UM.Signal import postponeSignals, CompressTechnique
|
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.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.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
|
from cura.UltimakerCloud.CloudMaterialSync import CloudMaterialSync
|
||||||
|
@ -330,13 +330,5 @@ class MaterialManagementModel(QObject):
|
||||||
"""
|
"""
|
||||||
Opens the window to sync all materials.
|
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()
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from typing import Dict, Optional, TYPE_CHECKING
|
||||||
import zipfile # To export all materials in a .zip archive.
|
import zipfile # To export all materials in a .zip archive.
|
||||||
|
|
||||||
import cura.CuraApplication # Imported like this to prevent circular imports.
|
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.PrinterOutput.UploadMaterialsJob import UploadMaterialsJob, UploadMaterialsError # To export materials to the output printer.
|
||||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
|
@ -42,6 +43,21 @@ class CloudMaterialSync(QObject):
|
||||||
self._showSyncNewMaterialsMessage()
|
self._showSyncNewMaterialsMessage()
|
||||||
break
|
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:
|
def _showSyncNewMaterialsMessage(self) -> None:
|
||||||
sync_materials_message = Message(
|
sync_materials_message = Message(
|
||||||
text = catalog.i18nc("@action:button",
|
text = catalog.i18nc("@action:button",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue