Fix custom profile menu

CURA-6599
This commit is contained in:
Lipu Fei 2019-09-25 08:28:21 +02:00
parent f2e518da6b
commit f395c92732
2 changed files with 9 additions and 4 deletions

View File

@ -1,9 +1,11 @@
# Copyright (c) 2019 Ultimaker B.V. # Copyright (c) 2019 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.
from PyQt5.QtCore import QObject
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
from PyQt5.QtCore import QObject, pyqtSlot
## Data struct to group several quality changes instance containers together. ## Data struct to group several quality changes instance containers together.
# #
# Each group represents one "custom profile" as the user sees it, which # Each group represents one "custom profile" as the user sees it, which
@ -20,5 +22,9 @@ class QualityChangesGroup(QObject):
self.metadata_for_global = {} # type: Dict[str, Any] self.metadata_for_global = {} # type: Dict[str, Any]
self.metadata_per_extruder = {} # type: Dict[int, Dict[str, Any]] self.metadata_per_extruder = {} # type: Dict[int, Dict[str, Any]]
@pyqtSlot(result = str)
def getName(self) -> str:
return self.name
def __str__(self) -> str: def __str__(self) -> str:
return "{class_name}[{name}, available = {is_available}]".format(class_name = self.__class__.__name__, name = self.name, is_available = self.is_available) return "{class_name}[{name}, available = {is_available}]".format(class_name = self.__class__.__name__, name = self.name, is_available = self.is_available)

View File

@ -163,7 +163,6 @@ Popup
//Add all the custom profiles. //Add all the custom profiles.
Repeater Repeater
{ {
visible: false
model: Cura.CustomQualityProfilesDropDownMenuModel model: Cura.CustomQualityProfilesDropDownMenuModel
MenuButton MenuButton
{ {
@ -172,8 +171,8 @@ Popup
width: parent.width width: parent.width
checkable: true checkable: true
visible: model.available visible: model.available
text: model.name + " - " + model.layer_height + " mm" text: model.name
checked: Cura.MachineManager.activeQualityChangesGroup == model.quality_changes_group checked: Cura.MachineManager.activeQualityChangesGroup.getName() == model.quality_changes_group.getName()
ButtonGroup.group: buttonGroup ButtonGroup.group: buttonGroup
} }
} }