mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-28 15:13:13 +08:00
Fix profile manager to support not supported custom profiles
CURA-4796 Profile manager should be able to show custom profiles that are based on the not supported profile correctly.
This commit is contained in:
parent
1d104f367d
commit
a3c2635648
@ -805,6 +805,7 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type")
|
qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type")
|
||||||
|
|
||||||
|
qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer")
|
||||||
qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel")
|
qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel")
|
||||||
qmlRegisterType(ContainerSettingsModel, "Cura", 1, 0, "ContainerSettingsModel")
|
qmlRegisterType(ContainerSettingsModel, "Cura", 1, 0, "ContainerSettingsModel")
|
||||||
qmlRegisterSingletonType(ProfilesModel, "Cura", 1, 0, "ProfilesModel", ProfilesModel.createProfilesModel)
|
qmlRegisterSingletonType(ProfilesModel, "Cura", 1, 0, "ProfilesModel", ProfilesModel.createProfilesModel)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# Copyright (c) 2017 Ultimaker B.V.
|
# Copyright (c) 2017 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import collections
|
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, Qt
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, Qt
|
||||||
|
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
@ -42,6 +40,8 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||||||
self.addRoleName(self.UserValueRole, "user_value")
|
self.addRoleName(self.UserValueRole, "user_value")
|
||||||
self.addRoleName(self.CategoryRole, "category")
|
self.addRoleName(self.CategoryRole, "category")
|
||||||
|
|
||||||
|
self._empty_quality = self._container_registry.findInstanceContainers(id = "empty_quality")[0]
|
||||||
|
|
||||||
def setExtruderId(self, extruder_id):
|
def setExtruderId(self, extruder_id):
|
||||||
if extruder_id != self._extruder_id:
|
if extruder_id != self._extruder_id:
|
||||||
self._extruder_id = extruder_id
|
self._extruder_id = extruder_id
|
||||||
@ -107,6 +107,9 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||||||
else:
|
else:
|
||||||
quality_changes_container = containers[0]
|
quality_changes_container = containers[0]
|
||||||
|
|
||||||
|
if quality_changes_container.getMetaDataEntry("quality_type") == "not_supported":
|
||||||
|
quality_container = self._empty_quality
|
||||||
|
else:
|
||||||
criteria = {
|
criteria = {
|
||||||
"type": "quality",
|
"type": "quality",
|
||||||
"quality_type": quality_changes_container.getMetaDataEntry("quality_type"),
|
"quality_type": quality_changes_container.getMetaDataEntry("quality_type"),
|
||||||
@ -117,9 +120,14 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||||||
if not quality_container:
|
if not quality_container:
|
||||||
Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId())
|
Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId())
|
||||||
return
|
return
|
||||||
|
|
||||||
quality_container = quality_container[0]
|
quality_container = quality_container[0]
|
||||||
|
|
||||||
quality_type = quality_container.getMetaDataEntry("quality_type")
|
quality_type = quality_container.getMetaDataEntry("quality_type")
|
||||||
|
|
||||||
|
if quality_type == "not_supported":
|
||||||
|
containers = []
|
||||||
|
else:
|
||||||
definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(quality_container.getDefinition())
|
definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(quality_container.getDefinition())
|
||||||
definition = quality_container.getDefinition()
|
definition = quality_container.getDefinition()
|
||||||
|
|
||||||
@ -163,6 +171,9 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if quality_changes_container:
|
if quality_changes_container:
|
||||||
|
if quality_type == "not_supported":
|
||||||
|
criteria = {"type": "quality_changes", "quality_type": quality_type, "name": quality_changes_container.getName()}
|
||||||
|
else:
|
||||||
criteria = {"type": "quality_changes", "quality_type": quality_type, "definition": definition_id, "name": quality_changes_container.getName()}
|
criteria = {"type": "quality_changes", "quality_type": quality_type, "definition": definition_id, "name": quality_changes_container.getName()}
|
||||||
if self._extruder_definition_id != "":
|
if self._extruder_definition_id != "":
|
||||||
extruder_definitions = self._container_registry.findDefinitionContainers(id = self._extruder_definition_id)
|
extruder_definitions = self._container_registry.findDefinitionContainers(id = self._extruder_definition_id)
|
||||||
@ -177,7 +188,6 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||||||
containers.extend(changes)
|
containers.extend(changes)
|
||||||
|
|
||||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
is_multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1
|
|
||||||
|
|
||||||
current_category = ""
|
current_category = ""
|
||||||
for definition in definition_container.findDefinitions():
|
for definition in definition_container.findDefinitions():
|
||||||
@ -213,7 +223,6 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||||||
if profile_value is None and user_value is None:
|
if profile_value is None and user_value is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if is_multi_extrusion:
|
|
||||||
settable_per_extruder = global_container_stack.getProperty(definition.key, "settable_per_extruder")
|
settable_per_extruder = global_container_stack.getProperty(definition.key, "settable_per_extruder")
|
||||||
# If a setting is not settable per extruder (global) and we're looking at an extruder tab, don't show this value.
|
# If a setting is not settable per extruder (global) and we're looking at an extruder tab, don't show this value.
|
||||||
if self._extruder_id != "" and not settable_per_extruder:
|
if self._extruder_id != "" and not settable_per_extruder:
|
||||||
|
@ -213,8 +213,8 @@ UM.ManagementPage
|
|||||||
ProfileTab
|
ProfileTab
|
||||||
{
|
{
|
||||||
title: catalog.i18nc("@title:tab", "Global Settings");
|
title: catalog.i18nc("@title:tab", "Global Settings");
|
||||||
quality: base.currentItem != null ? base.currentItem.id : "";
|
quality: Cura.MachineManager.activeMachine.qualityChanges.id
|
||||||
material: Cura.MachineManager.allActiveMaterialIds[Cura.MachineManager.activeMachineId]
|
material: Cura.MachineManager.activeMachine.material.id
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
|
Loading…
x
Reference in New Issue
Block a user