From bd84c4d98d66f0039e26ff4bb9c95cd513d3a2d1 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 3 Oct 2019 14:18:49 +0200 Subject: [PATCH 1/3] Show quality and intent a custom profile is based on CURA-6846 --- cura/Settings/MachineManager.py | 24 +++++++++++++++++++ .../Custom/CustomPrintSetup.qml | 12 ++++++---- .../PrintSetupSelectorHeader.qml | 13 ++++++---- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 0cd70970c8..37789b23a1 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -629,6 +629,16 @@ class MachineManager(QObject): intent_category = 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. @pyqtProperty("QStringList", notify=activeIntentChanged) def extruderPositionsWithNonActiveIntent(self): @@ -1663,11 +1673,25 @@ class MachineManager(QObject): return global_container_stack.qualityChanges.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) def hasNotSupportedQuality(self) -> bool: 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 + @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: if self._global_container_stack is None: return diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index c45a5fa8d7..33e2888fbb 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -88,14 +88,18 @@ Item function generateActiveQualityText() { + var result = Cura.MachineManager.activeQualityOrQualityChangesName - var result = "" - 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) { - result += Cura.MachineManager.activeIntentCategory + " - " + if (Cura.MachineManager.activeIntentName != "") + { + result += " - " + Cura.MachineManager.activeIntentName + } + result += " - " + Cura.MachineManager.activeQualityName } - result += Cura.MachineManager.activeQualityOrQualityChangesName if (Cura.MachineManager.isActiveQualityExperimental) { result += " (Experimental)" diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml index 5628867922..9340f64d89 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml @@ -20,13 +20,18 @@ RowLayout { if (Cura.MachineManager.activeStack) { - var text = "" - if(Cura.MachineManager.activeIntentCategory != "default") + var text = Cura.MachineManager.activeQualityOrQualityChangesName + + // 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) { text += " - " + layerHeight.properties.value + "mm" From 877bb1efdbd4a649533cefaf33f790c894456209 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 3 Oct 2019 15:55:38 +0200 Subject: [PATCH 2/3] Diable local printer ListView buffer to force redraw CURA-6793 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 6b074d2d8e..e4a7a98308 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -86,7 +86,11 @@ Item { 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 { From 38ae0e75f2914bafcf2a326ebcc1624e291fcf05 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 3 Oct 2019 16:25:09 +0200 Subject: [PATCH 3/3] Fallback to fdmprinter if not has_machine_quality Contributes to issue CURA-6847. --- cura/Settings/CuraContainerRegistry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 6aadb9bc6f..bd5269e874 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -21,6 +21,7 @@ from UM.Message import Message from UM.Platform import Platform from UM.PluginRegistry import PluginRegistry # For getting the possible profile writers to write with. from UM.Resources import Resources +from UM.Util import parseBool from cura.ReaderWriters.ProfileWriter import ProfileWriter from . import ExtruderStack @@ -238,7 +239,8 @@ class CuraContainerRegistry(ContainerRegistry): # Get the expected machine definition. # 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 # And check if the profile_definition matches either one (showing error if not):