From 902b9f278eda41b35509af128f10152a5eb1a93d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 9 Oct 2019 12:01:16 +0200 Subject: [PATCH 01/14] Add tooltips for view orientation buttons. --- resources/qml/ViewOrientationControls.qml | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index 5750e935f4..de594ac008 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -20,29 +20,59 @@ Row { iconSource: UM.Theme.getIcon("view_3d") onClicked: Cura.Actions.view3DCamera.trigger() + + UM.TooltipArea + { + anchors.fill: parent + text: catalog.i18nc("@info:tooltip", "3D View") + } } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_front") onClicked: Cura.Actions.viewFrontCamera.trigger() + + UM.TooltipArea + { + anchors.fill: parent + text: catalog.i18nc("@info:tooltip", "Front View") + } } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_top") onClicked: Cura.Actions.viewTopCamera.trigger() + + UM.TooltipArea + { + anchors.fill: parent + text: catalog.i18nc("@info:tooltip", "Top View") + } } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_left") onClicked: Cura.Actions.viewLeftSideCamera.trigger() + + UM.TooltipArea + { + anchors.fill: parent + text: catalog.i18nc("@info:tooltip", "Left View") + } } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_right") onClicked: Cura.Actions.viewRightSideCamera.trigger() + + UM.TooltipArea + { + anchors.fill: parent + text: catalog.i18nc("@info:tooltip", "Right View") + } } } From 25db711adc2878248a3273ecf91cebdbe04f5fd7 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 10 Oct 2019 12:57:27 +0200 Subject: [PATCH 02/14] Fix tooltips absorbed mouseclicks for view-buttons. --- resources/qml/ViewOrientationControls.qml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index de594ac008..97f2bb9400 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -25,6 +25,7 @@ Row { anchors.fill: parent text: catalog.i18nc("@info:tooltip", "3D View") + acceptedButtons: Qt.NoButton } } @@ -37,6 +38,7 @@ Row { anchors.fill: parent text: catalog.i18nc("@info:tooltip", "Front View") + acceptedButtons: Qt.NoButton } } @@ -49,6 +51,7 @@ Row { anchors.fill: parent text: catalog.i18nc("@info:tooltip", "Top View") + acceptedButtons: Qt.NoButton } } @@ -61,6 +64,7 @@ Row { anchors.fill: parent text: catalog.i18nc("@info:tooltip", "Left View") + acceptedButtons: Qt.NoButton } } @@ -73,6 +77,7 @@ Row { anchors.fill: parent text: catalog.i18nc("@info:tooltip", "Right View") + acceptedButtons: Qt.NoButton } } } From 07a20e131aa96f440eb89a2ab575eedc880bbcf6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 10 Oct 2019 13:03:39 +0200 Subject: [PATCH 03/14] Prevent changing material / variant of disabled extruder It is disabled, so changing it's material / variant doesn't make that much sense... CURA-6872 --- .../qml/Menus/ConfigurationMenu/CustomConfiguration.qml | 5 ++++- resources/qml/Menus/MaterialMenu.qml | 3 +++ resources/qml/Menus/NozzleMenu.qml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 6f3d6ffa17..fda9ee35ac 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -221,6 +221,7 @@ Item OldControls.CheckBox { + id: enabledCheckbox checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. height: parent.height @@ -265,6 +266,7 @@ Item text: Cura.MachineManager.activeStack !== null ? Cura.MachineManager.activeStack.material.name : "" tooltip: text + enabled: enabledCheckbox.checked width: selectors.controlWidth height: parent.height @@ -324,7 +326,8 @@ Item height: parent.height width: selectors.controlWidth style: UM.Theme.styles.print_setup_header_button - activeFocusOnPress: true; + activeFocusOnPress: true + enabled: enabledCheckbox.checked menu: Cura.NozzleMenu { extruderIndex: Cura.ExtruderManager.activeExtruderIndex } } diff --git a/resources/qml/Menus/MaterialMenu.qml b/resources/qml/Menus/MaterialMenu.qml index a574e240d3..9720c81879 100644 --- a/resources/qml/Menus/MaterialMenu.qml +++ b/resources/qml/Menus/MaterialMenu.qml @@ -50,6 +50,7 @@ Menu { text: model.brand + " " + model.name checkable: true + enabled: Cura.MachineManager.activeMachine.extruderList[extruderIndex].isEnabled checked: model.root_material_id === menu.currentRootMaterialId onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) exclusiveGroup: favoriteGroup // One favorite and one item from the others can be active at the same time. @@ -72,6 +73,7 @@ Menu { text: model.name checkable: true + enabled: Cura.MachineManager.activeMachine.extruderList[extruderIndex].isEnabled checked: model.root_material_id === menu.currentRootMaterialId exclusiveGroup: group onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) @@ -110,6 +112,7 @@ Menu { text: model.name checkable: true + enabled: Cura.MachineManager.activeMachine.extruderList[extruderIndex].isEnabled checked: model.id === menu.activeMaterialId exclusiveGroup: group onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) diff --git a/resources/qml/Menus/NozzleMenu.qml b/resources/qml/Menus/NozzleMenu.qml index a94ad10330..a291f125eb 100644 --- a/resources/qml/Menus/NozzleMenu.qml +++ b/resources/qml/Menus/NozzleMenu.qml @@ -32,7 +32,7 @@ Menu return extruder.variant.name == model.hotend_name } exclusiveGroup: group - + enabled: Cura.MachineManager.activeMachine.extruderList[extruderIndex].isEnabled onTriggered: { Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node); } From faf50a301c88256153e835c5afc16db4bae26573 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Thu, 10 Oct 2019 10:09:49 -0600 Subject: [PATCH 04/14] Overwrite prime_tower_position_* value not default_value The default value here would not be used. Override must be `value` not `default_value` solves #6491 for BIBO but other printers may also be affected by #6491. --- resources/definitions/bibo2_dual.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/bibo2_dual.def.json b/resources/definitions/bibo2_dual.def.json index dbfb03a0c9..0197426ac6 100644 --- a/resources/definitions/bibo2_dual.def.json +++ b/resources/definitions/bibo2_dual.def.json @@ -85,10 +85,10 @@ "default_value": 2 }, "prime_tower_position_x": { - "default_value": 50 + "value": "50" }, "prime_tower_position_y": { - "default_value": 50 + "value": "50" } } } From 05a6c9c3cf16d3e8c4b6c7be7554be4c4685d192 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 11 Oct 2019 11:04:16 +0200 Subject: [PATCH 05/14] Make code a bit smarter about reusing ExtruderConfigurationModels This prevents a lot of unneeded signal noise --- cura/PrinterOutput/Models/MaterialOutputModel.py | 8 ++++++++ cura/Settings/MachineManager.py | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cura/PrinterOutput/Models/MaterialOutputModel.py b/cura/PrinterOutput/Models/MaterialOutputModel.py index 7a17ef3cce..3714824a89 100644 --- a/cura/PrinterOutput/Models/MaterialOutputModel.py +++ b/cura/PrinterOutput/Models/MaterialOutputModel.py @@ -34,3 +34,11 @@ class MaterialOutputModel(QObject): @pyqtProperty(str, constant = True) def name(self) -> str: return self._name + + def __eq__(self, other): + if self is other: + return True + if type(other) is not MaterialOutputModel: + return False + + return self.guid == other.guid and self.type == other.type and self.brand == other.brand and self.color == other.color and self.name == other.name diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 3fb55c0e70..19ba83032b 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -182,9 +182,11 @@ class MachineManager(QObject): # Create the configuration model with the current data in Cura self._current_printer_configuration.printerType = self._global_container_stack.definition.getName() - self._current_printer_configuration.extruderConfigurations = [] - for extruder in self._global_container_stack.extruderList: - extruder_configuration = ExtruderConfigurationModel() + + if len(self._current_printer_configuration.extruderConfigurations) != len(self._global_container_stack.extruderList): + self._current_printer_configuration.extruderConfigurations = [ExtruderConfigurationModel() for extruder in self._global_container_stack.extruderList] + + for extruder, extruder_configuration in zip(self._global_container_stack.extruderList, self._current_printer_configuration.extruderConfigurations): # For compare just the GUID is needed at this moment mat_type = extruder.material.getMetaDataEntry("material") if extruder.material != empty_material_container else None mat_guid = extruder.material.getMetaDataEntry("GUID") if extruder.material != empty_material_container else None @@ -196,7 +198,6 @@ class MachineManager(QObject): extruder_configuration.position = int(extruder.getMetaDataEntry("position")) extruder_configuration.material = material_model extruder_configuration.hotendID = extruder.variant.getName() if extruder.variant != empty_variant_container else None - self._current_printer_configuration.extruderConfigurations.append(extruder_configuration) # An empty build plate configuration from the network printer is presented as an empty string, so use "" for an # empty build plate. From be675d93430150981a6da350ca28e495070d509d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 11 Oct 2019 14:33:08 +0200 Subject: [PATCH 06/14] Remove unused signal --- cura/Machines/MachineErrorChecker.py | 1 - cura/Settings/MachineManager.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/cura/Machines/MachineErrorChecker.py b/cura/Machines/MachineErrorChecker.py index cfeeb630df..4c6ed891b1 100644 --- a/cura/Machines/MachineErrorChecker.py +++ b/cura/Machines/MachineErrorChecker.py @@ -58,7 +58,6 @@ class MachineErrorChecker(QObject): # Whenever the machine settings get changed, we schedule an error check. self._machine_manager.globalContainerChanged.connect(self.startErrorCheck) - self._machine_manager.globalValueChanged.connect(self.startErrorCheck) self._onMachineChanged() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 19ba83032b..4be019df8e 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -95,7 +95,6 @@ class MachineManager(QObject): extruder_manager.activeExtruderChanged.connect(self.activeQualityChanged) self.globalContainerChanged.connect(self.activeStackChanged) - self.globalValueChanged.connect(self.activeStackValueChanged) ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeStackChanged) self.activeStackChanged.connect(self.activeStackValueChanged) @@ -143,7 +142,6 @@ class MachineManager(QObject): activeStackChanged = pyqtSignal() # Emitted whenever the active stack is changed (ie: when changing between extruders, changing a profile, but not when changing a value) extruderChanged = pyqtSignal() - globalValueChanged = pyqtSignal() # Emitted whenever a value inside global container is changed. activeStackValueChanged = pyqtSignal() # Emitted whenever a value inside the active stack is changed. activeStackValidationChanged = pyqtSignal() # Emitted whenever a validation inside active container is changed stacksValidationChanged = pyqtSignal() # Emitted whenever a validation is changed From bba43fafccb6a1bab86b50df94fe7c843072f6cc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 11 Oct 2019 14:35:44 +0200 Subject: [PATCH 07/14] Remove another unused signal --- cura/Settings/MachineManager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 4be019df8e..1fadcf01c5 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -154,7 +154,6 @@ class MachineManager(QObject): printerConnectedStatusChanged = pyqtSignal() # Emitted every time the active machine change or the outputdevices change rootMaterialChanged = pyqtSignal() - discoveredPrintersChanged = pyqtSignal() def setInitialActiveMachine(self) -> None: active_machine_id = self._application.getPreferences().getValue("cura/active_machine") From 4cb59b54545c4e4894d96a73cf85f13b83f02203 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Oct 2019 11:02:43 +0200 Subject: [PATCH 08/14] Fix overriding of prime tower position We had changed it for all printers back when we changed the prime tower position to a formula, but since then we've been getting new printer definitions that were made from templates floating around with the old structure. We should really have an automated test for this. Discovered during review of #6518. --- resources/definitions/Mark2_for_Ultimaker2.def.json | 4 ++-- resources/definitions/builder_premium_large.def.json | 4 ++-- resources/definitions/builder_premium_medium.def.json | 4 ++-- resources/definitions/builder_premium_small.def.json | 4 ++-- resources/definitions/cartesio.def.json | 4 ++-- resources/definitions/raise3D_N2_dual.def.json | 4 ++-- resources/definitions/raise3D_N2_plus_dual.def.json | 4 ++-- resources/definitions/raise3D_N2_plus_single.def.json | 4 ++-- resources/definitions/raise3D_N2_single.def.json | 4 ++-- resources/definitions/ultimaker_s3.def.json | 4 ++-- resources/definitions/ultimaker_s5.def.json | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/resources/definitions/Mark2_for_Ultimaker2.def.json b/resources/definitions/Mark2_for_Ultimaker2.def.json index 5aada425fd..b02dc78adf 100644 --- a/resources/definitions/Mark2_for_Ultimaker2.def.json +++ b/resources/definitions/Mark2_for_Ultimaker2.def.json @@ -209,10 +209,10 @@ "enabled": false }, "prime_tower_position_x": { - "default_value": 185 + "value": "185" }, "prime_tower_position_y": { - "default_value": 160 + "value": "160" }, "machine_disallowed_areas": { "default_value": [ diff --git a/resources/definitions/builder_premium_large.def.json b/resources/definitions/builder_premium_large.def.json index 3ceae8d63f..d100cd1ba9 100644 --- a/resources/definitions/builder_premium_large.def.json +++ b/resources/definitions/builder_premium_large.def.json @@ -50,8 +50,8 @@ "speed_wall_0": { "value": "math.ceil(speed_wall * 20 / 25)" }, "speed_wall_x": { "value": "speed_wall" }, - "prime_tower_position_x": { "default_value": 175 }, - "prime_tower_position_y": { "default_value": 178 }, + "prime_tower_position_x": { "value": "175" }, + "prime_tower_position_y": { "value": "178" }, "prime_tower_wipe_enabled": { "default_value": false }, "prime_tower_min_volume": { "default_value": 50 }, diff --git a/resources/definitions/builder_premium_medium.def.json b/resources/definitions/builder_premium_medium.def.json index 5f608ba2a8..16aeeffdae 100644 --- a/resources/definitions/builder_premium_medium.def.json +++ b/resources/definitions/builder_premium_medium.def.json @@ -50,8 +50,8 @@ "speed_wall_0": { "value": "math.ceil(speed_wall * 20 / 25)" }, "speed_wall_x": { "value": "speed_wall" }, - "prime_tower_position_x": { "default_value": 175 }, - "prime_tower_position_y": { "default_value": 178 }, + "prime_tower_position_x": { "value": "175" }, + "prime_tower_position_y": { "value": "178" }, "prime_tower_wipe_enabled": { "default_value": false }, "prime_tower_min_volume": { "default_value": 50 }, diff --git a/resources/definitions/builder_premium_small.def.json b/resources/definitions/builder_premium_small.def.json index a19773ec05..290e79660f 100644 --- a/resources/definitions/builder_premium_small.def.json +++ b/resources/definitions/builder_premium_small.def.json @@ -49,8 +49,8 @@ "speed_wall_0": { "value": "math.ceil(speed_wall * 20 / 25)" }, "speed_wall_x": { "value": "speed_wall" }, - "prime_tower_position_x": { "default_value": 175 }, - "prime_tower_position_y": { "default_value": 178 }, + "prime_tower_position_x": { "value": "175" }, + "prime_tower_position_y": { "value": "178" }, "prime_tower_wipe_enabled": { "default_value": false }, "prime_tower_min_volume": { "default_value": 50 }, diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index 4ed1a9f2d9..e7a005682d 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -44,8 +44,8 @@ "prime_tower_enable": { "default_value": false }, "prime_tower_min_volume": { "value": "0.7" }, "prime_tower_size": { "value": 24.0 }, - "prime_tower_position_x": { "value": 125 }, - "prime_tower_position_y": { "value": 70 }, + "prime_tower_position_x": { "value": "125" }, + "prime_tower_position_y": { "value": "70" }, "prime_blob_enable": { "default_value": false }, "machine_max_feedrate_z": { "default_value": 20 }, "machine_disallowed_areas": { "default_value": [ diff --git a/resources/definitions/raise3D_N2_dual.def.json b/resources/definitions/raise3D_N2_dual.def.json index 1994cc2bcb..530ad79d19 100644 --- a/resources/definitions/raise3D_N2_dual.def.json +++ b/resources/definitions/raise3D_N2_dual.def.json @@ -76,10 +76,10 @@ "default_value": 2 }, "prime_tower_position_x": { - "default_value": 195 + "value": "195" }, "prime_tower_position_y": { - "default_value": 149 + "value": "149" } } } diff --git a/resources/definitions/raise3D_N2_plus_dual.def.json b/resources/definitions/raise3D_N2_plus_dual.def.json index 23ad1fbd09..ffc4afec16 100644 --- a/resources/definitions/raise3D_N2_plus_dual.def.json +++ b/resources/definitions/raise3D_N2_plus_dual.def.json @@ -76,10 +76,10 @@ "default_value": 2 }, "prime_tower_position_x": { - "default_value": 195 + "value": "195" }, "prime_tower_position_y": { - "default_value": 149 + "value": "149" } } } diff --git a/resources/definitions/raise3D_N2_plus_single.def.json b/resources/definitions/raise3D_N2_plus_single.def.json index f8a1a7e0fb..ccb169efb1 100644 --- a/resources/definitions/raise3D_N2_plus_single.def.json +++ b/resources/definitions/raise3D_N2_plus_single.def.json @@ -72,10 +72,10 @@ "default_value": "M107\nM1002\nM104 S0 T1\nM104 S0 T0\nM140 S0\nM117 Print Complete.\nG28 X0 Y0\nG91\nG1 Z10\nG90\nM84" }, "prime_tower_position_x": { - "default_value": 195 + "value": "195" }, "prime_tower_position_y": { - "default_value": 149 + "value": "149" } } } diff --git a/resources/definitions/raise3D_N2_single.def.json b/resources/definitions/raise3D_N2_single.def.json index c69823466b..f0915d1a31 100644 --- a/resources/definitions/raise3D_N2_single.def.json +++ b/resources/definitions/raise3D_N2_single.def.json @@ -72,10 +72,10 @@ "default_value": "M107\nM1002\nM104 S0 T1\nM104 S0 T0\nM140 S0\nM117 Print Complete.\nG28 X0 Y0\nG91\nG1 Z10\nG90\nM84" }, "prime_tower_position_x": { - "default_value": 195 + "value": "195" }, "prime_tower_position_y": { - "default_value": 149 + "value": "149" } } } diff --git a/resources/definitions/ultimaker_s3.def.json b/resources/definitions/ultimaker_s3.def.json index f7f3a038fe..0d6834521e 100644 --- a/resources/definitions/ultimaker_s3.def.json +++ b/resources/definitions/ultimaker_s3.def.json @@ -68,8 +68,8 @@ "extruder_prime_pos_abs": { "default_value": true }, "machine_start_gcode": { "default_value": "" }, "machine_end_gcode": { "default_value": "" }, - "prime_tower_position_x": { "default_value": 345 }, - "prime_tower_position_y": { "default_value": 222.5 }, + "prime_tower_position_x": { "value": "345" }, + "prime_tower_position_y": { "value": "222.5" }, "prime_blob_enable": { "enabled": true, "default_value": false }, "speed_travel": diff --git a/resources/definitions/ultimaker_s5.def.json b/resources/definitions/ultimaker_s5.def.json index fef8c87c27..dfa8da5397 100644 --- a/resources/definitions/ultimaker_s5.def.json +++ b/resources/definitions/ultimaker_s5.def.json @@ -70,8 +70,8 @@ "extruder_prime_pos_abs": { "default_value": true }, "machine_start_gcode": { "default_value": "" }, "machine_end_gcode": { "default_value": "" }, - "prime_tower_position_x": { "default_value": 345 }, - "prime_tower_position_y": { "default_value": 222.5 }, + "prime_tower_position_x": { "value": "345" }, + "prime_tower_position_y": { "value": "222.5" }, "prime_blob_enable": { "enabled": true, "default_value": false }, "speed_travel": From 8f668091598f684f5d37f6ab324760266c341af8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 14 Oct 2019 14:33:50 +0200 Subject: [PATCH 09/14] Always show custom qualities CURA-6882 --- cura/Machines/MachineNode.py | 11 +++-------- .../PrintSetupSelector/Custom/CustomPrintSetup.qml | 5 +++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cura/Machines/MachineNode.py b/cura/Machines/MachineNode.py index e71801fbb1..29968512ce 100644 --- a/cura/Machines/MachineNode.py +++ b/cura/Machines/MachineNode.py @@ -134,6 +134,9 @@ class MachineNode(ContainerNode): groups_by_name[name] = QualityChangesGroup(name, quality_type = quality_changes["quality_type"], intent_category = quality_changes.get("intent_category", "default"), parent = CuraApplication.getInstance()) + # CURA-6882 + # Custom qualities are always available, even if they are based on the "not supported" profile. + groups_by_name[name].is_available = True elif groups_by_name[name].intent_category == "default": # Intent category should be stored as "default" if everything is default or as the intent if any of the extruder have an actual intent. groups_by_name[name].intent_category = quality_changes.get("intent_category", "default") @@ -142,14 +145,6 @@ class MachineNode(ContainerNode): else: # Global profile. groups_by_name[name].metadata_for_global = quality_changes - quality_groups = self.getQualityGroups(variant_names, material_bases, extruder_enabled) - for quality_changes_group in groups_by_name.values(): - if quality_changes_group.quality_type not in quality_groups: - quality_changes_group.is_available = False - else: - # Quality changes group is available iff the quality group it depends on is available. Irrespective of whether the intent category is available. - quality_changes_group.is_available = quality_groups[quality_changes_group.quality_type].is_available - return list(groups_by_name.values()) ## Gets the preferred global quality node, going by the preferred quality diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 2698089d0c..99fdafdb73 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -110,6 +110,11 @@ Item resultSuffix += " (Experimental)" } + if (Cura.MachineManager.isActiveQualityCustom) + { + result = resultMain + } + if (Cura.MachineManager.isActiveQualitySupported) { if (Cura.MachineManager.activeQualityLayerHeight > 0) From 2e0fd21c60aa587c4de906485961239a37618b6a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 14 Oct 2019 14:47:43 +0200 Subject: [PATCH 10/14] Fix setVariantByName() --- cura/Settings/MachineManager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1fadcf01c5..dec433e8f8 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1514,7 +1514,8 @@ class MachineManager(QObject): if self._global_container_stack is None: return machine_definition_id = self._global_container_stack.definition.id - variant_node = self._variant_manager.getVariantNode(machine_definition_id, variant_name) + machine_node = ContainerTree.getInstance().machines.get(machine_definition_id) + variant_node = machine_node.variants.get(variant_name) self.setVariant(position, variant_node) @pyqtSlot(str, "QVariant") From 54f7892f2d85ba0ff76eb7f82b002527cdb8ac0a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 14 Oct 2019 15:25:28 +0200 Subject: [PATCH 11/14] Sort built-in qualities by layer height for all CURA-6883 --- cura/Machines/Models/QualityManagementModel.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cura/Machines/Models/QualityManagementModel.py b/cura/Machines/Models/QualityManagementModel.py index adaa4309b7..1d30b1753e 100644 --- a/cura/Machines/Models/QualityManagementModel.py +++ b/cura/Machines/Models/QualityManagementModel.py @@ -13,6 +13,7 @@ from cura.Settings.ContainerManager import ContainerManager from cura.Machines.ContainerTree import ContainerTree from cura.Settings.cura_empty_instance_containers import empty_quality_changes_container from cura.Settings.IntentManager import IntentManager +from cura.Machines.Models.MachineModelUtils import fetchLayerHeight from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") @@ -295,6 +296,8 @@ class QualityManagementModel(ListModel): if not quality_group.is_available: continue + layer_height = fetchLayerHeight(quality_group) + item = {"name": quality_group.name, "is_read_only": True, "quality_group": quality_group, @@ -302,10 +305,11 @@ class QualityManagementModel(ListModel): "quality_changes_group": None, "intent_category": "default", "section_name": catalog.i18nc("@label", "Default"), + "layer_height": layer_height, # layer_height is only used for sorting } item_list.append(item) - # Sort by quality names - item_list = sorted(item_list, key = lambda x: x["name"].upper()) + # Sort by layer_height for built-in qualities + item_list = sorted(item_list, key = lambda x: x["layer_height"]) # Create intent items (non-default) available_intent_list = IntentManager.getInstance().getCurrentAvailableIntents() From 096b6431c5c253bc33cc1492b3fd88b02d79e5e0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Oct 2019 14:36:07 +0200 Subject: [PATCH 12/14] Fix typos in g-code comments --- resources/definitions/creality_base.def.json | 2 +- resources/definitions/creality_ender5.def.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/creality_base.def.json b/resources/definitions/creality_base.def.json index d7e028f31a..7e91fb4989 100644 --- a/resources/definitions/creality_base.def.json +++ b/resources/definitions/creality_base.def.json @@ -125,7 +125,7 @@ "overrides": { "machine_name": { "default_value": "Creawsome Base Printer" }, "machine_start_gcode": { "default_value": "M201 X500.00 Y500.00 Z100.00 E5000.00 ;Setup machine max acceleration\nM203 X500.00 Y500.00 Z10.00 E50.00 ;Setup machine max feedrate\nM204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration\nM205 X8.00 Y8.00 Z0.40 E5.00 ;Setup Jerk\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\n\nG28 ;Home\n\nG92 E0 ;Reset Extruder\nG1 Z2.0 F3000 ;Move Z Axis up\nG1 X10.1 Y20 Z0.28 F5000.0 ;Move to start position\nG1 X10.1 Y200.0 Z0.28 F1500.0 E15 ;Draw the first line\nG1 X10.4 Y200.0 Z0.28 F5000.0 ;Move to side a little\nG1 X10.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line\nG92 E0 ;Reset Extruder\nG1 Z2.0 F3000 ;Move Z Axis up\n" }, - "machine_end_gcode": { "default_value": "G91 ;Relative positionning\nG1 E-2 F2700 ;Retract a bit\nG1 E-2 Z0.2 F2400 ;Retract and raise Z\nG1 X5 Y5 F3000 ;Wipe out\nG1 Z10 ;Raise Z more\nG90 ;Absolute positionning\n\nG1 X0 Y{machine_depth} ;Present print\nM106 S0 ;Turn-off fan\nM104 S0 ;Turn-off hotend\nM140 S0 ;Turn-off bed\n\nM84 X Y E ;Disable all steppers but Z\n" }, + "machine_end_gcode": { "default_value": "G91 ;Relative positioning\nG1 E-2 F2700 ;Retract a bit\nG1 E-2 Z0.2 F2400 ;Retract and raise Z\nG1 X5 Y5 F3000 ;Wipe out\nG1 Z10 ;Raise Z more\nG90 ;Absolute positionning\n\nG1 X0 Y{machine_depth} ;Present print\nM106 S0 ;Turn-off fan\nM104 S0 ;Turn-off hotend\nM140 S0 ;Turn-off bed\n\nM84 X Y E ;Disable all steppers but Z\n" }, "machine_max_feedrate_x": { "value": 500 }, "machine_max_feedrate_y": { "value": 500 }, diff --git a/resources/definitions/creality_ender5.def.json b/resources/definitions/creality_ender5.def.json index d95f4a1467..c1511884ae 100644 --- a/resources/definitions/creality_ender5.def.json +++ b/resources/definitions/creality_ender5.def.json @@ -4,7 +4,7 @@ "inherits": "creality_base", "overrides": { "machine_name": { "default_value": "Creality Ender-5" }, - "machine_end_gcode": { "default_value": "G91 ;Relative positionning\nG1 E-2 F2700 ;Retract a bit\nG1 E-2 Z0.2 F2400 ;Retract and raise Z\nG1 X5 Y5 F3000 ;Wipe out\nG1 Z10 ;Raise Z more\nG90 ;Absolute positionning\n\nG1 X0 Y0 ;Present print\nM106 S0 ;Turn-off fan\nM104 S0 ;Turn-off hotend\nM140 S0 ;Turn-off bed\n\nM84 X Y E ;Disable all steppers but Z\n" }, + "machine_end_gcode": { "default_value": "G91 ;Relative positioning\nG1 E-2 F2700 ;Retract a bit\nG1 E-2 Z0.2 F2400 ;Retract and raise Z\nG1 X5 Y5 F3000 ;Wipe out\nG1 Z10 ;Raise Z more\nG90 ;Absolute positionning\n\nG1 X0 Y0 ;Present print\nM106 S0 ;Turn-off fan\nM104 S0 ;Turn-off hotend\nM140 S0 ;Turn-off bed\n\nM84 X Y E ;Disable all steppers but Z\n" }, "machine_width": { "default_value": 220 }, "machine_depth": { "default_value": 220 }, "machine_height": { "default_value": 300 }, From 577365cf968a78767a8b45f843f924e8e221191a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 15 Oct 2019 08:19:32 +0200 Subject: [PATCH 13/14] Fx containerAdded handling in VariantNode CURA-6889 --- cura/Machines/VariantNode.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index 27e359afb1..efe15dbec2 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -101,6 +101,14 @@ class VariantNode(ContainerNode): def _materialAdded(self, container: ContainerInterface) -> None: if container.getMetaDataEntry("type") != "material": return # Not interested. + if not ContainerRegistry.getInstance().findContainersMetadata(id = container.getId()): + # CURA-6889 + # containerAdded and removed signals may be triggered in the next event cycle. If a container gets added + # and removed in the same event cycle, in the next cycle, the connections should just ignore the signals. + # The check here makes sure that the container in the signal still exists. + Logger.log("d", "Got container added signal for container [%s] but it no longer exists, do nothing.", + container.getId()) + return if not self.machine.has_materials: return # We won't add any materials. material_definition = container.getMetaDataEntry("definition") From 84080b675b7b5ac1377fc1ec287eb2bb59b75529 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 15 Oct 2019 08:29:53 +0200 Subject: [PATCH 14/14] Fix tests --- tests/Machines/TestVariantNode.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/Machines/TestVariantNode.py b/tests/Machines/TestVariantNode.py index 71257bd972..4e58069be3 100644 --- a/tests/Machines/TestVariantNode.py +++ b/tests/Machines/TestVariantNode.py @@ -104,10 +104,11 @@ def test_variantNodeInit_excludedMaterial(container_registry, machine_node): def test_materialAdded(container_registry, machine_node, metadata, material_result_list): variant_node = createVariantNode("machine_1", machine_node, container_registry) machine_node.exclude_materials = ["material_3"] - with patch("cura.Machines.VariantNode.MaterialNode"): # We're not testing the material node here, so patch it out. - with patch.dict(metadata_dict, metadata): - mocked_container = createMockedInstanceContainer() - variant_node._materialAdded(mocked_container) + with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value = container_registry)): + with patch("cura.Machines.VariantNode.MaterialNode"): # We're not testing the material node here, so patch it out. + with patch.dict(metadata_dict, metadata): + mocked_container = createMockedInstanceContainer() + variant_node._materialAdded(mocked_container) assert len(material_result_list) == len(variant_node.materials) for name in material_result_list: