From dc6339b2950029b42e177d92a7b1f8ce2bd6d779 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 4 Mar 2020 11:56:57 +0100 Subject: [PATCH 1/4] Change the infill-only checkbox in per object settings to a dropdown CURA-7255 --- .../PerObjectSettingsPanel.qml | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 109b66a11b..ce14b97a59 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -49,18 +49,6 @@ Item visibility_handler.addSkipResetSetting(currentMeshType) } - function setOverhangsMeshType() - { - if (infillOnlyCheckbox.checked) - { - setMeshType(infillMeshType) - } - else - { - setMeshType(cuttingMeshType) - } - } - function setMeshType(type) { UM.ActiveTool.setProperty("MeshType", type) @@ -140,22 +128,40 @@ Item verticalAlignment: Text.AlignVCenter } - CheckBox + + ComboBox { - id: infillOnlyCheckbox + id: infillOnlyComboBox + width: parent.width / 2 - UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@action:checkbox", "Infill only"); + model: ListModel + { + id: infillOnlyComboBoxModel - style: UM.Theme.styles.checkbox; + Component.onCompleted: { + append({ text: catalog.i18nc("@item:inlistbox", "Infill only") }) + append({ text: catalog.i18nc("@item:inlistbox", "Cutting mesh") }) + } + } visible: currentMeshType === infillMeshType || currentMeshType === cuttingMeshType - onClicked: setOverhangsMeshType() + + + onActivated: + { + print(index) + if (index == 0){ + setMeshType(infillMeshType) + } else { + setMeshType(cuttingMeshType) + } + } Binding { - target: infillOnlyCheckbox - property: "checked" - value: currentMeshType === infillMeshType + target: infillOnlyComboBox + property: "currentIndex" + value: currentMeshType === infillMeshType ? 0 : 1 } } From 8c0a2ff72e12715530efed23a26b1e72ed761860 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 6 Mar 2020 11:14:49 +0100 Subject: [PATCH 2/4] Remove debug print --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index ce14b97a59..801fdc59be 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -149,7 +149,6 @@ Item onActivated: { - print(index) if (index == 0){ setMeshType(infillMeshType) } else { From ce12827879601c0ca5e77049b01374dc5d2c6984 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Thu, 12 Mar 2020 13:25:29 +0100 Subject: [PATCH 3/4] Fix infill mesh defaults not visible when changing per object settings The problem: When infill mesh is set, wall_thickness and top_bottom_thickness are added to the settings. Then these settings are set to visible on the visibility_handler. It appears however, that the visibility_handler considers all added settings to be visible. It thus concludes that no UI update is necessary because the settings are already added. --- .../PerObjectSettingsTool/PerObjectSettingsPanel.qml | 2 +- plugins/PerObjectSettingsTool/PerObjectSettingsTool.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 109b66a11b..70e408c2bf 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -159,7 +159,7 @@ Item } } - Column // Settings Dialog + Column // List of selected Settings to override for the selected object { // This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar. // It kinda looks ugly otherwise (big panel, no content on it) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py index 84ed312295..4f0d90a8e3 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py @@ -82,6 +82,7 @@ class PerObjectSettingsTool(Tool): selected_object.addDecorator(SettingOverrideDecorator()) stack = selected_object.callDecoration("getStack") + settings_visibility_changed = False settings = stack.getTop() for property_key in ["infill_mesh", "cutting_mesh", "support_mesh", "anti_overhang_mesh"]: if property_key != mesh_type: @@ -103,11 +104,14 @@ class PerObjectSettingsTool(Tool): new_instance.setProperty("value", 0) new_instance.resetState() # Ensure that the state is not seen as a user state. settings.addInstance(new_instance) - visible = self.visibility_handler.getVisible() - visible.add(property_key) - self.visibility_handler.setVisible(visible) + settings_visibility_changed = True + elif old_mesh_type == "infill_mesh" and settings.getInstance(property_key) and settings.getProperty(property_key, "value") == 0: settings.removeInstance(property_key) + settings_visibility_changed = True + + if settings_visibility_changed: + self.visibility_handler.forceVisibilityChanged() self.propertyChanged.emit() return True From 2625bbef44ab2cf6c2c0addf49d47cf2caa6be47 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Thu, 12 Mar 2020 14:01:03 +0100 Subject: [PATCH 4/4] Changed pos infill only label per suggestions by Tim and Yi-An CURA-7255 --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 801fdc59be..5a71fc1ad8 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -139,7 +139,7 @@ Item id: infillOnlyComboBoxModel Component.onCompleted: { - append({ text: catalog.i18nc("@item:inlistbox", "Infill only") }) + append({ text: catalog.i18nc("@item:inlistbox", "Infill mesh only") }) append({ text: catalog.i18nc("@item:inlistbox", "Cutting mesh") }) } }