mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 03:19:04 +08:00
Singleton management in Cura
-QualityManagementModel, MaterialManagementModel, SimpleModeSettingsManager, MachineActionManager and CustomQualityProfilesDropDownMenuModel *deleted* -QualityProfilesDropDownmenuModel changed to RegisterType CURA-7812
This commit is contained in:
parent
b60b07e2b2
commit
11aa71a5df
@ -1138,6 +1138,10 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
return cast(MachineActionManager.MachineActionManager, self._machine_action_manager)
|
return cast(MachineActionManager.MachineActionManager, self._machine_action_manager)
|
||||||
|
|
||||||
|
@pyqtSlot(result = QObject)
|
||||||
|
def getMachineActionManagerQml(self)-> MachineActionManager.MachineActionManager:
|
||||||
|
return cast(QObject, self._machine_action_manager)
|
||||||
|
|
||||||
@pyqtSlot(result = QObject)
|
@pyqtSlot(result = QObject)
|
||||||
def getMaterialManagementModel(self) -> MaterialManagementModel:
|
def getMaterialManagementModel(self) -> MaterialManagementModel:
|
||||||
if not self._material_management_model:
|
if not self._material_management_model:
|
||||||
@ -1150,7 +1154,8 @@ class CuraApplication(QtApplication):
|
|||||||
self._quality_management_model = QualityManagementModel(parent = self)
|
self._quality_management_model = QualityManagementModel(parent = self)
|
||||||
return self._quality_management_model
|
return self._quality_management_model
|
||||||
|
|
||||||
def getSimpleModeSettingsManager(self, *args):
|
@pyqtSlot(result=QObject)
|
||||||
|
def getSimpleModeSettingsManager(self)-> SimpleModeSettingsManager:
|
||||||
if self._simple_mode_settings_manager is None:
|
if self._simple_mode_settings_manager is None:
|
||||||
self._simple_mode_settings_manager = SimpleModeSettingsManager()
|
self._simple_mode_settings_manager = SimpleModeSettingsManager()
|
||||||
return self._simple_mode_settings_manager
|
return self._simple_mode_settings_manager
|
||||||
@ -1193,12 +1198,14 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
return self._print_information
|
return self._print_information
|
||||||
|
|
||||||
def getQualityProfilesDropDownMenuModel(self, *args, **kwargs):
|
pyqtSlot(result =QObject)
|
||||||
|
def getQualityProfilesDropDownMenuModel(self, *args, **kwargs)-> QualityProfilesDropDownMenuModel:
|
||||||
if self._quality_profile_drop_down_menu_model is None:
|
if self._quality_profile_drop_down_menu_model is None:
|
||||||
self._quality_profile_drop_down_menu_model = QualityProfilesDropDownMenuModel(self)
|
self._quality_profile_drop_down_menu_model = QualityProfilesDropDownMenuModel(self)
|
||||||
return self._quality_profile_drop_down_menu_model
|
return self._quality_profile_drop_down_menu_model
|
||||||
|
|
||||||
def getCustomQualityProfilesDropDownMenuModel(self, *args, **kwargs):
|
pyqtSlot(result=QObject)
|
||||||
|
def getCustomQualityProfilesDropDownMenuModel(self, *args, **kwargs)->CustomQualityProfilesDropDownMenuModel:
|
||||||
if self._custom_quality_profile_drop_down_menu_model is None:
|
if self._custom_quality_profile_drop_down_menu_model is None:
|
||||||
self._custom_quality_profile_drop_down_menu_model = CustomQualityProfilesDropDownMenuModel(self)
|
self._custom_quality_profile_drop_down_menu_model = CustomQualityProfilesDropDownMenuModel(self)
|
||||||
return self._custom_quality_profile_drop_down_menu_model
|
return self._custom_quality_profile_drop_down_menu_model
|
||||||
@ -1231,8 +1238,6 @@ class CuraApplication(QtApplication):
|
|||||||
qmlRegisterSingletonType(MachineManager, "Cura", 1, 0, self.getMachineManager, "MachineManager")
|
qmlRegisterSingletonType(MachineManager, "Cura", 1, 0, self.getMachineManager, "MachineManager")
|
||||||
qmlRegisterSingletonType(IntentManager, "Cura", 1, 6, self.getIntentManager, "IntentManager")
|
qmlRegisterSingletonType(IntentManager, "Cura", 1, 6, self.getIntentManager, "IntentManager")
|
||||||
qmlRegisterSingletonType(SettingInheritanceManager, "Cura", 1, 0, self.getSettingInheritanceManager, "SettingInheritanceManager")
|
qmlRegisterSingletonType(SettingInheritanceManager, "Cura", 1, 0, self.getSettingInheritanceManager, "SettingInheritanceManager")
|
||||||
qmlRegisterSingletonType(SimpleModeSettingsManager, "Cura", 1, 0, self.getSimpleModeSettingsManager, "SimpleModeSettingsManager")
|
|
||||||
qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, self.getMachineActionManager, "MachineActionManager")
|
|
||||||
|
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
qmlRegisterType(NetworkingUtil, "Cura", 1, 5, "NetworkingUtil")
|
qmlRegisterType(NetworkingUtil, "Cura", 1, 5, "NetworkingUtil")
|
||||||
@ -1257,16 +1262,11 @@ class CuraApplication(QtApplication):
|
|||||||
qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel")
|
qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel")
|
||||||
qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel")
|
qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel")
|
||||||
qmlRegisterType(MaterialBrandsModel, "Cura", 1, 0, "MaterialBrandsModel")
|
qmlRegisterType(MaterialBrandsModel, "Cura", 1, 0, "MaterialBrandsModel")
|
||||||
qmlRegisterSingletonType(QualityManagementModel, "Cura", 1, 0, self.getQualityManagementModel, "QualityManagementModel")
|
|
||||||
qmlRegisterSingletonType(MaterialManagementModel, "Cura", 1, 5, self.getMaterialManagementModel, "MaterialManagementModel")
|
|
||||||
|
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
qmlRegisterType(DiscoveredPrintersModel, "Cura", 1, 0, "DiscoveredPrintersModel")
|
qmlRegisterType(DiscoveredPrintersModel, "Cura", 1, 0, "DiscoveredPrintersModel")
|
||||||
qmlRegisterType(DiscoveredCloudPrintersModel, "Cura", 1, 7, "DiscoveredCloudPrintersModel")
|
qmlRegisterType(DiscoveredCloudPrintersModel, "Cura", 1, 7, "DiscoveredCloudPrintersModel")
|
||||||
qmlRegisterSingletonType(QualityProfilesDropDownMenuModel, "Cura", 1, 0,
|
qmlRegisterType(QualityProfilesDropDownMenuModel, "Cura", 1, 0, "QualityProfilesDropDownMenuModel")
|
||||||
self.getQualityProfilesDropDownMenuModel, "QualityProfilesDropDownMenuModel")
|
|
||||||
qmlRegisterSingletonType(CustomQualityProfilesDropDownMenuModel, "Cura", 1, 0,
|
|
||||||
self.getCustomQualityProfilesDropDownMenuModel, "CustomQualityProfilesDropDownMenuModel")
|
|
||||||
qmlRegisterType(NozzleModel, "Cura", 1, 0, "NozzleModel")
|
qmlRegisterType(NozzleModel, "Cura", 1, 0, "NozzleModel")
|
||||||
qmlRegisterType(IntentModel, "Cura", 1, 6, "IntentModel")
|
qmlRegisterType(IntentModel, "Cura", 1, 6, "IntentModel")
|
||||||
qmlRegisterType(IntentCategoryModel, "Cura", 1, 6, "IntentCategoryModel")
|
qmlRegisterType(IntentCategoryModel, "Cura", 1, 6, "IntentCategoryModel")
|
||||||
|
@ -12,6 +12,7 @@ import Cura 1.0 as Cura
|
|||||||
UM.ManagementPage
|
UM.ManagementPage
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
property var machineActionManager: CuraApplication.getMachineActionManagerQml()
|
||||||
Item { enabled: false; UM.I18nCatalog { id: catalog; name: "cura"} }
|
Item { enabled: false; UM.I18nCatalog { id: catalog; name: "cura"} }
|
||||||
|
|
||||||
title: catalog.i18nc("@title:tab", "Printers")
|
title: catalog.i18nc("@title:tab", "Printers")
|
||||||
@ -58,10 +59,11 @@ UM.ManagementPage
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: UM.Theme.getSize("default_margin").height
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
id: machineActionRepeater
|
id: machineActionRepeater
|
||||||
model: base.currentItem ? Cura.MachineActionManager.getSupportedActions(Cura.MachineManager.getDefinitionByMachineId(base.currentItem.id)) : null
|
model: base.currentItem ? machineActionManager.getSupportedActions(Cura.MachineManager.getDefinitionByMachineId(base.currentItem.id)) : null
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ Popup
|
|||||||
//Add all the custom profiles.
|
//Add all the custom profiles.
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: Cura.CustomQualityProfilesDropDownMenuModel
|
model: CuraApplication.getCustomQualityProfilesDropDownMenuModel()
|
||||||
MenuButton
|
MenuButton
|
||||||
{
|
{
|
||||||
onClicked: Cura.MachineManager.setQualityChangesGroup(model.quality_changes_group)
|
onClicked: Cura.MachineManager.setQualityChangesGroup(model.quality_changes_group)
|
||||||
|
@ -11,7 +11,7 @@ import "../Dialogs"
|
|||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons?
|
property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons?
|
||||||
|
property var simpleModeSettingsManager :CuraApplication.getSimpleModeSettingsManager()
|
||||||
height: visible ? UM.Theme.getSize("action_button_icon").height : 0
|
height: visible ? UM.Theme.getSize("action_button_icon").height : 0
|
||||||
width: visible ? childrenRect.width: 0
|
width: visible ? childrenRect.width: 0
|
||||||
visible: Cura.MachineManager.hasUserSettings || (fullWarning && Cura.MachineManager.hasCustomQuality)
|
visible: Cura.MachineManager.hasUserSettings || (fullWarning && Cura.MachineManager.hasCustomQuality)
|
||||||
@ -96,7 +96,7 @@ Item
|
|||||||
State
|
State
|
||||||
{
|
{
|
||||||
name: "custom settings changed"
|
name: "custom settings changed"
|
||||||
when: Cura.SimpleModeSettingsManager.isProfileCustomized
|
when: simpleModeSettingsManager.isProfileCustomized
|
||||||
PropertyChanges
|
PropertyChanges
|
||||||
{
|
{
|
||||||
target: warning
|
target: warning
|
||||||
|
Loading…
x
Reference in New Issue
Block a user