Fix cura crashing

`activeQualityDisplayNameMap` no longer returned a dict and could thus not be a pyqt property

Cura-9773
This commit is contained in:
c.lamboo 2022-11-28 13:14:47 +01:00
parent 8e8437eab0
commit be40920042
3 changed files with 6 additions and 7 deletions

View File

@ -1634,17 +1634,16 @@ class MachineManager(QObject):
# - "my_profile - Engineering - Fine" (based on an intent) # - "my_profile - Engineering - Fine" (based on an intent)
@pyqtProperty("QList<QString>", notify = activeQualityDisplayNameChanged) @pyqtProperty("QList<QString>", notify = activeQualityDisplayNameChanged)
def activeQualityDisplayNameStringParts(self) -> List[str]: def activeQualityDisplayNameStringParts(self) -> List[str]:
return self.activeQualityDisplayNameMap.getStringParts() return self.activeQualityDisplayNameMap().getStringParts()
@pyqtProperty("QList<QString>", notify = activeQualityDisplayNameChanged) @pyqtProperty("QList<QString>", notify = activeQualityDisplayNameChanged)
def activeQualityDisplayNameMainStringParts(self) -> List[str]: def activeQualityDisplayNameMainStringParts(self) -> List[str]:
return self.activeQualityDisplayNameMap.getMainStringParts() return self.activeQualityDisplayNameMap().getMainStringParts()
@pyqtProperty("QList<QString>", notify = activeQualityDisplayNameChanged) @pyqtProperty("QList<QString>", notify = activeQualityDisplayNameChanged)
def activeQualityDisplayNameTailStringParts(self) -> List[str]: def activeQualityDisplayNameTailStringParts(self) -> List[str]:
return self.activeQualityDisplayNameMap.getTailStringParts() return self.activeQualityDisplayNameMap().getTailStringParts()
@pyqtProperty("QVariantMap", notify = activeQualityDisplayNameChanged)
def activeQualityDisplayNameMap(self) -> ActiveQuality: def activeQualityDisplayNameMap(self) -> ActiveQuality:
global_stack = self._application.getGlobalContainerStack() global_stack = self._application.getGlobalContainerStack()
if global_stack is None: if global_stack is None:

View File

@ -226,7 +226,7 @@ class UFPWriter(MeshWriter):
"changes": {}, "changes": {},
"all_settings": {}, "all_settings": {},
}, },
"quality": asdict(machine_manager.activeQualityDisplayNameMap), "quality": asdict(machine_manager.activeQualityDisplayNameMap()),
} }
global_stack = cast(GlobalStack, Application.getInstance().getGlobalContainerStack()) global_stack = cast(GlobalStack, Application.getInstance().getGlobalContainerStack())

View File

@ -56,7 +56,7 @@ UM.Dialog
UM.Label UM.Label
{ {
id: infoText id: infoText
text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings. Would you like to Keep these changed settings after switching profiles? Alternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"]) text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings. Would you like to Keep these changed settings after switching profiles? Alternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMainStringParts.join(" - "))
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@ -83,7 +83,7 @@ UM.Dialog
columnHeaders: [ columnHeaders: [
catalog.i18nc("@title:column", "Profile settings"), catalog.i18nc("@title:column", "Profile settings"),
Cura.MachineManager.activeQualityDisplayNameMap["main"], Cura.MachineManager.activeQualityDisplayNameMainStringParts.join(" - "),
catalog.i18nc("@title:column", "Current changes") catalog.i18nc("@title:column", "Current changes")
] ]
model: UM.TableModel model: UM.TableModel