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.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import QObject
from typing import Any, Dict, Optional
from PyQt5.QtCore import QObject, pyqtSlot
## Data struct to group several quality changes instance containers together.
#
# 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_per_extruder = {} # type: Dict[int, Dict[str, Any]]
@pyqtSlot(result = str)
def getName(self) -> str:
return self.name
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)

View file

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