Show quality and intent a custom profile is based on

CURA-6846
This commit is contained in:
Lipu Fei 2019-10-03 14:18:49 +02:00
parent 027768f151
commit bd84c4d98d
3 changed files with 41 additions and 8 deletions

View file

@ -629,6 +629,16 @@ class MachineManager(QObject):
intent_category = category intent_category = category
return intent_category return intent_category
# Returns the human-readable name of the active intent category. If the intent category is "default", returns an
# empty string.
@pyqtProperty(str, notify = activeIntentChanged)
def activeIntentName(self) -> str:
intent_category = self.activeIntentCategory
if intent_category == "default":
intent_category = ""
intent_name = intent_category.capitalize()
return intent_name
# Provies a list of extruder positions that have a different intent from the active one. # Provies a list of extruder positions that have a different intent from the active one.
@pyqtProperty("QStringList", notify=activeIntentChanged) @pyqtProperty("QStringList", notify=activeIntentChanged)
def extruderPositionsWithNonActiveIntent(self): def extruderPositionsWithNonActiveIntent(self):
@ -1663,11 +1673,25 @@ class MachineManager(QObject):
return global_container_stack.qualityChanges.getName() return global_container_stack.qualityChanges.getName()
return global_container_stack.quality.getName() return global_container_stack.quality.getName()
@pyqtProperty(str, notify = activeQualityChanged)
def activeQualityName(self) -> str:
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
if global_stack is None:
return empty_quality_container.getName()
return global_stack.quality.getName()
@pyqtProperty(bool, notify = activeQualityGroupChanged) @pyqtProperty(bool, notify = activeQualityGroupChanged)
def hasNotSupportedQuality(self) -> bool: def hasNotSupportedQuality(self) -> bool:
global_container_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() global_container_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
return (not global_container_stack is None) and global_container_stack.quality == empty_quality_container and global_container_stack.qualityChanges == empty_quality_changes_container return (not global_container_stack is None) and global_container_stack.quality == empty_quality_container and global_container_stack.qualityChanges == empty_quality_changes_container
@pyqtProperty(bool, notify = activeQualityGroupChanged)
def isActiveQualityCustom(self) -> bool:
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
if global_stack is None:
return False
return global_stack.qualityChanges != empty_quality_changes_container
def _updateUponMaterialMetadataChange(self) -> None: def _updateUponMaterialMetadataChange(self) -> None:
if self._global_container_stack is None: if self._global_container_stack is None:
return return

View file

@ -88,14 +88,18 @@ Item
function generateActiveQualityText() function generateActiveQualityText()
{ {
var result = Cura.MachineManager.activeQualityOrQualityChangesName
var result = "" // If this is a custom quality, add intent (if present) and quality it is based on
if(Cura.MachineManager.activeIntentCategory != "default") if (Cura.MachineManager.isActiveQualityCustom)
{ {
result += Cura.MachineManager.activeIntentCategory + " - " if (Cura.MachineManager.activeIntentName != "")
{
result += " - " + Cura.MachineManager.activeIntentName
}
result += " - " + Cura.MachineManager.activeQualityName
} }
result += Cura.MachineManager.activeQualityOrQualityChangesName
if (Cura.MachineManager.isActiveQualityExperimental) if (Cura.MachineManager.isActiveQualityExperimental)
{ {
result += " (Experimental)" result += " (Experimental)"

View file

@ -20,13 +20,18 @@ RowLayout
{ {
if (Cura.MachineManager.activeStack) if (Cura.MachineManager.activeStack)
{ {
var text = "" var text = Cura.MachineManager.activeQualityOrQualityChangesName
if(Cura.MachineManager.activeIntentCategory != "default")
// If this is a custom quality, add intent (if present) and quality it is based on
if (Cura.MachineManager.isActiveQualityCustom)
{ {
text += Cura.MachineManager.activeIntentCategory + " - " if (Cura.MachineManager.activeIntentName != "")
{
text += " - " + Cura.MachineManager.activeIntentName
}
text += " - " + Cura.MachineManager.activeQualityName
} }
text += Cura.MachineManager.activeQualityOrQualityChangesName
if (!Cura.MachineManager.hasNotSupportedQuality) if (!Cura.MachineManager.hasNotSupportedQuality)
{ {
text += " - " + layerHeight.properties.value + "mm" text += " - " + layerHeight.properties.value + "mm"