Merge branch 'feature_intent' of github.com:Ultimaker/Cura into feature_intent

This commit is contained in:
Jaime van Kessel 2019-10-04 09:39:47 +02:00
commit 4793c77380
No known key found for this signature in database
GPG Key ID: 3710727397403C91
5 changed files with 49 additions and 10 deletions

View File

@ -21,6 +21,7 @@ from UM.Message import Message
from UM.Platform import Platform from UM.Platform import Platform
from UM.PluginRegistry import PluginRegistry # For getting the possible profile writers to write with. from UM.PluginRegistry import PluginRegistry # For getting the possible profile writers to write with.
from UM.Resources import Resources from UM.Resources import Resources
from UM.Util import parseBool
from cura.ReaderWriters.ProfileWriter import ProfileWriter from cura.ReaderWriters.ProfileWriter import ProfileWriter
from . import ExtruderStack from . import ExtruderStack
@ -238,7 +239,8 @@ class CuraContainerRegistry(ContainerRegistry):
# Get the expected machine definition. # Get the expected machine definition.
# i.e.: We expect gcode for a UM2 Extended to be defined as normal UM2 gcode... # i.e.: We expect gcode for a UM2 Extended to be defined as normal UM2 gcode...
profile_definition = machine_definition.getMetaDataEntry("quality_definition", machine_definition.getId()) has_machine_quality = parseBool(machine_definition.getMetaDataEntry("has_machine_quality", "false"))
profile_definition = machine_definition.getMetaDataEntry("quality_definition", machine_definition.getId()) if has_machine_quality else "fdmprinter"
expected_machine_definition = container_tree.machines[global_stack.definition.getId()].quality_definition expected_machine_definition = container_tree.machines[global_stack.definition.getId()].quality_definition
# And check if the profile_definition matches either one (showing error if not): # And check if the profile_definition matches either one (showing error if not):

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"

View File

@ -86,7 +86,11 @@ Item
{ {
id: machineList id: machineList
cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. // CURA-6793
// Enabling the buffer seems to cause the blank items issue. When buffer is enabled, if the ListView's
// individual item has a dynamic change on its visibility, the ListView doesn't redraw itself.
// The default value of cacheBuffer is platform-dependent, so we explicitly disable it here.
cacheBuffer: 0
model: UM.DefinitionContainersModel model: UM.DefinitionContainersModel
{ {