From 8cea9c5b8755250490a0c8ca618b48e39972115a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 5 Jul 2019 13:03:20 +0200 Subject: [PATCH] Register IntentManager in QML This way we can change the intent from the interface. Contributes to issue CURA-6597. --- cura/CuraApplication.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f2d74a02bf..953336fc30 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -61,8 +61,6 @@ from cura.Arranging.Arrange import Arrange from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray -from cura.Machines.Models.IntentModel import IntentModel -from cura.Machines.Models.IntentCategoryModel import IntentCategoryModel from cura.Operations.SetParentOperation import SetParentOperation @@ -93,6 +91,8 @@ from cura.Machines.Models.QualityProfilesDropDownMenuModel import QualityProfile from cura.Machines.Models.QualitySettingsModel import QualitySettingsModel from cura.Machines.Models.SettingVisibilityPresetsModel import SettingVisibilityPresetsModel from cura.Machines.Models.UserChangesModel import UserChangesModel +from cura.Machines.Models.IntentModel import IntentModel +from cura.Machines.Models.IntentCategoryModel import IntentCategoryModel from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage @@ -105,6 +105,7 @@ from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderStack import ExtruderStack from cura.Settings.MachineManager import MachineManager from cura.Settings.MachineNameValidator import MachineNameValidator +from cura.Settings.IntentManager import IntentManager from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler from cura.Settings.SettingInheritanceManager import SettingInheritanceManager from cura.Settings.SidebarCustomMenuItemsModel import SidebarCustomMenuItemsModel @@ -938,6 +939,9 @@ class CuraApplication(QtApplication): def getQualityManager(self, *args) -> "QualityManager": return self._quality_manager + def getIntentManager(self, *args) -> IntentManager: + return IntentManager.getInstance() + def getObjectsModel(self, *args): if self._object_manager is None: self._object_manager = ObjectsModel(self) @@ -1037,6 +1041,7 @@ class CuraApplication(QtApplication): qmlRegisterSingletonType(CuraSceneController, "Cura", 1, 0, "SceneController", self.getCuraSceneController) qmlRegisterSingletonType(ExtruderManager, "Cura", 1, 0, "ExtruderManager", self.getExtruderManager) qmlRegisterSingletonType(MachineManager, "Cura", 1, 0, "MachineManager", self.getMachineManager) + qmlRegisterSingletonType(IntentManager, "Cura", 1, 6, "IntentManager", self.getIntentManager) qmlRegisterSingletonType(SettingInheritanceManager, "Cura", 1, 0, "SettingInheritanceManager", self.getSettingInheritanceManager) qmlRegisterSingletonType(SimpleModeSettingsManager, "Cura", 1, 0, "SimpleModeSettingsManager", self.getSimpleModeSettingsManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager)