From 87c81055e3e5ea39c592bde2d7a3cd2b988b5ad0 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Thu, 5 Sep 2019 17:13:20 +0200 Subject: [PATCH 01/25] Update the per-object-settings icon --- plugins/PerObjectSettingsTool/tool_icon.svg | 25 ++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/plugins/PerObjectSettingsTool/tool_icon.svg b/plugins/PerObjectSettingsTool/tool_icon.svg index 4b15eb453f..41e49cae07 100644 --- a/plugins/PerObjectSettingsTool/tool_icon.svg +++ b/plugins/PerObjectSettingsTool/tool_icon.svg @@ -1,3 +1,22 @@ - - - + + + + per_model_settings + Created with Sketch. + + + + + + + + + + + + + + + + + \ No newline at end of file From 789ebc4df85463d1830453bcf48a50e42611b2ff Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Thu, 5 Sep 2019 18:44:57 +0200 Subject: [PATCH 02/25] Update the Support Eraser (support blocker) icon --- plugins/SupportEraser/tool_icon.svg | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/SupportEraser/tool_icon.svg b/plugins/SupportEraser/tool_icon.svg index a0f8a3e3c3..a2753446a9 100644 --- a/plugins/SupportEraser/tool_icon.svg +++ b/plugins/SupportEraser/tool_icon.svg @@ -1,11 +1,14 @@ - - + + + + support_blocker Created with Sketch. - - - - - + + + + + + - + \ No newline at end of file From a457265c074e4178b71b6e4bd1d28afa5e6065c3 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 6 Sep 2019 14:10:38 +0200 Subject: [PATCH 03/25] Update the Support Eraser icon size --- plugins/SupportEraser/tool_icon.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SupportEraser/tool_icon.svg b/plugins/SupportEraser/tool_icon.svg index a2753446a9..fee69e0715 100644 --- a/plugins/SupportEraser/tool_icon.svg +++ b/plugins/SupportEraser/tool_icon.svg @@ -1,5 +1,5 @@ - + support_blocker Created with Sketch. From 305243817776468e30bdc25d271b3c5c331056c5 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 6 Sep 2019 15:39:02 +0200 Subject: [PATCH 04/25] Add Per Object Settings icons --- .../icons/pos_modify_dont_support_overlap.svg | 26 +++++++++++++++++++ .../cura-light/icons/pos_modify_overlaps.svg | 17 ++++++++++++ .../themes/cura-light/icons/pos_normal.svg | 9 +++++++ .../cura-light/icons/pos_print_as_support.svg | 14 ++++++++++ 4 files changed, 66 insertions(+) create mode 100644 resources/themes/cura-light/icons/pos_modify_dont_support_overlap.svg create mode 100644 resources/themes/cura-light/icons/pos_modify_overlaps.svg create mode 100644 resources/themes/cura-light/icons/pos_normal.svg create mode 100644 resources/themes/cura-light/icons/pos_print_as_support.svg diff --git a/resources/themes/cura-light/icons/pos_modify_dont_support_overlap.svg b/resources/themes/cura-light/icons/pos_modify_dont_support_overlap.svg new file mode 100644 index 0000000000..124e95f558 --- /dev/null +++ b/resources/themes/cura-light/icons/pos_modify_dont_support_overlap.svg @@ -0,0 +1,26 @@ + + + + pms_modify_dont_support_overlap + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/pos_modify_overlaps.svg b/resources/themes/cura-light/icons/pos_modify_overlaps.svg new file mode 100644 index 0000000000..3ad69c05c3 --- /dev/null +++ b/resources/themes/cura-light/icons/pos_modify_overlaps.svg @@ -0,0 +1,17 @@ + + + + pms_modify_overlaps + Created with Sketch. + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/pos_normal.svg b/resources/themes/cura-light/icons/pos_normal.svg new file mode 100644 index 0000000000..8a49ef3a00 --- /dev/null +++ b/resources/themes/cura-light/icons/pos_normal.svg @@ -0,0 +1,9 @@ + + + + pms_Normal + Created with Sketch. + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/pos_print_as_support.svg b/resources/themes/cura-light/icons/pos_print_as_support.svg new file mode 100644 index 0000000000..3562ca1fe0 --- /dev/null +++ b/resources/themes/cura-light/icons/pos_print_as_support.svg @@ -0,0 +1,14 @@ + + + + pms_printassupport + Created with Sketch. + + + + + + + + + \ No newline at end of file From 760234f69b2e2b7aba1e10d70d77e1ef25c51df4 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 6 Sep 2019 16:08:57 +0200 Subject: [PATCH 05/25] Per Object Settings qml for icon buttons --- .../PerObjectSettingsPanel.qml | 899 +++++++++--------- 1 file changed, 466 insertions(+), 433 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 035d2e5299..188101817c 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -4,22 +4,67 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 -import QtQuick.Window 2.2 import UM 1.2 as UM import Cura 1.0 as Cura import ".." -Item { - id: base; - UM.I18nCatalog { id: catalog; name: "cura"; } - - width: childrenRect.width; - height: childrenRect.height; +Item +{ + id: base + width: childrenRect.width + height: childrenRect.height property var all_categories_except_support: [ "machine_settings", "resolution", "shell", "infill", "material", "speed", "travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"] + readonly property var normal_mesh_type: "" + readonly property var support_mesh_type: "support_mesh" + readonly property var cutting_mesh_type: "cutting_mesh" + readonly property var infill_mesh_type: "infill_mesh" + readonly property var anti_overhang_mesh_type: "anti_overhang_mesh" + + property var current_mesh_type: normal_mesh_type + + + function setOverhangsMeshType(){ + if(infillOnlyCheckbox.checked) + { + setMeshType(infill_mesh_type) + } + else + { + setMeshType(cutting_mesh_type) + } + } + + function setMeshType(type) { + current_mesh_type = type + + // update the active object + if(UM.ActiveTool.properties.getValue("MeshType") !== type) + { + UM.ActiveTool.setProperty("MeshType", type) + } + + // set checked state of mesh type buttons + normalButton.checked = current_mesh_type === normal_mesh_type + supportMeshButton.checked = current_mesh_type === support_mesh_type + overhangMeshButton.checked = current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type + antiOverhangMeshButton.checked = current_mesh_type === anti_overhang_mesh_type + + // update active type label + for (var button in meshTypeButtons.children) + { + if(meshTypeButtons.children[button].checked){ + meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text + break + } + } + } + + UM.I18nCatalog { id: catalog; name: "uranium"} + Column { id: items @@ -28,490 +73,477 @@ Item { spacing: UM.Theme.getSize("default_margin").height - Row + Component.onCompleted: setMeshType(UM.ActiveTool.properties.getValue("MeshType")) + + Row // Mesh type buttons + { + id: meshTypeButtons + spacing: UM.Theme.getSize("default_margin").width + + Button + { + id: normalButton + text: catalog.i18nc("@label", "Normal model") + iconSource: UM.Theme.getIcon("pos_normal"); + property bool needBorder: true + checkable: true + onClicked: base.setMeshType(normal_mesh_type); + style: UM.Theme.styles.tool_button; + z: 4 + } + + Button + { + id: supportMeshButton + text: catalog.i18nc("@label", "Print as support") + iconSource: UM.Theme.getIcon("pos_print_as_support"); + property bool needBorder: true + checkable:true + onClicked: base.setMeshType(support_mesh_type) + style: UM.Theme.styles.tool_button; + z: 3 + } + + Button + { + id: overhangMeshButton + text: catalog.i18nc("@label", "Modify settings for overlays") + iconSource: UM.Theme.getIcon("pos_modify_overlaps"); + property bool needBorder: true + checkable:true + onClicked: base.setMeshType(infill_mesh_type) + style: UM.Theme.styles.tool_button; + z: 2 + } + + Button + { + id: antiOverhangMeshButton + text: catalog.i18nc("@label", "Don't support overlaps") + iconSource: UM.Theme.getIcon("pos_modify_dont_support_overlap"); + property bool needBorder: true + checkable: true + onClicked: base.setMeshType(anti_overhang_mesh_type) + style: UM.Theme.styles.tool_button; + z: 1 + } + + } + + Row // Selected mesh type label { spacing: UM.Theme.getSize("default_margin").width - Label + Label { - text: catalog.i18nc("@label","Mesh Type") + id: meshTypeLabel font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") height: UM.Theme.getSize("setting").height verticalAlignment: Text.AlignVCenter } - UM.SettingPropertyProvider - { - id: meshTypePropertyProvider - containerStack: Cura.MachineManager.activeMachine - watchedProperties: [ "enabled" ] - } - - ComboBox - { - id: meshTypeSelection - style: UM.Theme.styles.combobox - onActivated: { - UM.ActiveTool.setProperty("MeshType", model.get(index).type) - } - model: ListModel - { - id: meshTypeModel - Component.onCompleted: meshTypeSelection.populateModel() - } - - function populateModel() - { - meshTypeModel.append({ - type: "", - text: catalog.i18nc("@label", "Normal model") - }); - meshTypePropertyProvider.key = "support_mesh"; - if(meshTypePropertyProvider.properties.enabled == "True") - { - meshTypeModel.append({ - type: "support_mesh", - text: catalog.i18nc("@label", "Print as support") - }); - } - meshTypePropertyProvider.key = "anti_overhang_mesh"; - if(meshTypePropertyProvider.properties.enabled == "True") - { - meshTypeModel.append({ - type: "anti_overhang_mesh", - text: catalog.i18nc("@label", "Don't support overlap with other models") - }); - } - meshTypePropertyProvider.key = "cutting_mesh"; - if(meshTypePropertyProvider.properties.enabled == "True") - { - meshTypeModel.append({ - type: "cutting_mesh", - text: catalog.i18nc("@label", "Modify settings for overlap with other models") - }); - } - meshTypePropertyProvider.key = "infill_mesh"; - if(meshTypePropertyProvider.properties.enabled == "True") - { - meshTypeModel.append({ - type: "infill_mesh", - text: catalog.i18nc("@label", "Modify settings for infill of other models") - }); - } - - meshTypeSelection.updateCurrentIndex(); - } - - function updateCurrentIndex() - { - var mesh_type = UM.ActiveTool.properties.getValue("MeshType"); - meshTypeSelection.currentIndex = -1; - for(var index=0; index < meshTypeSelection.model.count; index++) - { - if(meshTypeSelection.model.get(index).type == mesh_type) - { - meshTypeSelection.currentIndex = index; - return; - } - } - meshTypeSelection.currentIndex = 0; - } - } - - Connections - { - target: Cura.MachineManager - onGlobalContainerChanged: - { - meshTypeSelection.model.clear(); - meshTypeSelection.populateModel(); - } - } - - Connections - { - target: UM.Selection - onSelectionChanged: meshTypeSelection.updateCurrentIndex() - } - } - Column + Row // Infill-only checkbox (visible for overhang mesh button) { - // 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) - id: currentSettings - property int maximumHeight: 200 * screenScaleFactor - height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) - visible: meshTypeSelection.model.get(meshTypeSelection.currentIndex).type != "anti_overhang_mesh" + spacing: UM.Theme.getSize("default_margin").width - ScrollView + + CheckBox { - height: parent.height - width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width - style: UM.Theme.styles.scrollview + id: infillOnlyCheckbox - ListView - { - id: contents - spacing: UM.Theme.getSize("default_lining").height + text: catalog.i18nc("@action:checkbox","Infill only"); - model: UM.SettingDefinitionsModel - { - id: addedSettingsModel; - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - expanded: [ "*" ] - filter: - { - if (printSequencePropertyProvider.properties.value == "one_at_a_time") - { - return {"settable_per_meshgroup": true}; - } - return {"settable_per_mesh": true}; - } - exclude: - { - var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]; + style: UM.Theme.styles.checkbox; - if(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh") - { - excluded_settings = excluded_settings.concat(base.all_categories_except_support); - } - return excluded_settings; - } - - visibilityHandler: Cura.PerObjectSettingVisibilityHandler - { - selectedObjectId: UM.ActiveTool.properties.getValue("SelectedObjectId") - } - - // For some reason the model object is updated after removing him from the memory and - // it happens only on Windows. For this reason, set the destroyed value manually. - Component.onDestruction: { - setDestroyed(true); - } - } - - delegate: Row - { - spacing: - UM.Theme.getSize("default_margin").width - Loader - { - id: settingLoader - width: UM.Theme.getSize("setting").width - height: UM.Theme.getSize("section").height - - property var definition: model - property var settingDefinitionsModel: addedSettingsModel - property var propertyProvider: provider - property var globalPropertyProvider: inheritStackProvider - property var externalResetHandler: false - - //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 - //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, - //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" && model.type != "extruder" - - onLoaded: { - settingLoader.item.showRevertButton = false - settingLoader.item.showInheritButton = false - settingLoader.item.showLinkedSettingIcon = false - settingLoader.item.doDepthIndentation = false - settingLoader.item.doQualityUserSettingEmphasis = false - } - - sourceComponent: - { - switch(model.type) - { - case "int": - return settingTextField - case "[int]": - return settingTextField - case "float": - return settingTextField - case "enum": - return settingComboBox - case "extruder": - return settingExtruder - case "optional_extruder": - return settingOptionalExtruder - case "bool": - return settingCheckBox - case "str": - return settingTextField - case "category": - return settingCategory - default: - return settingUnknown - } - } - } - - Button - { - width: Math.round(UM.Theme.getSize("setting").height / 2) - height: UM.Theme.getSize("setting").height - - onClicked: addedSettingsModel.setVisible(model.key, false) - - style: ButtonStyle - { - background: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - height: width - sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") - source: UM.Theme.getIcon("minus") - } - } - } - } - - // Specialty provider that only watches global_inherits (we cant filter on what property changed we get events - // so we bypass that to make a dedicated provider). - UM.SettingPropertyProvider - { - id: provider - - containerStackId: UM.ActiveTool.properties.getValue("ContainerID") - key: model.key - watchedProperties: [ "value", "enabled", "validationState" ] - storeIndex: 0 - removeUnusedValue: false - } - - UM.SettingPropertyProvider - { - id: inheritStackProvider - containerStackId: UM.ActiveTool.properties.getValue("ContainerID") - key: model.key - watchedProperties: [ "limit_to_extruder" ] - } - - Connections - { - target: inheritStackProvider - onPropertiesChanged: - { - provider.forcePropertiesChanged(); - } - } - - Connections - { - target: UM.ActiveTool - onPropertiesChanged: - { - // the values cannot be bound with UM.ActiveTool.properties.getValue() calls, - // so here we connect to the signal and update the those values. - if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") - { - const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId"); - if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) - { - addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId; - } - } - if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") - { - const containerId = UM.ActiveTool.properties.getValue("ContainerID"); - if (provider.containerStackId != containerId) - { - provider.containerStackId = containerId; - } - if (inheritStackProvider.containerStackId != containerId) - { - inheritStackProvider.containerStackId = containerId; - } - } - } - } - } - } + checked: base.current_mesh_type === base.infill_mesh_type + onClicked: base.setOverhangsMeshType() } } - Button + Row { - id: customiseSettingsButton; - height: UM.Theme.getSize("setting_control").height; - visible: currentSettings.visible + spacing: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@action:button", "Select settings"); - - style: ButtonStyle + Button { - background: Rectangle - { - width: control.width; - height: control.height; - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.pressed ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - color: control.pressed ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - label: Label - { - text: control.text; - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default") - anchors.centerIn: parent - } - } + id: customiseSettingsButton; + height: UM.Theme.getSize("setting_control").height; + visible: currentSettings.visible - onClicked: - { - settingPickDialog.visible = true; - if (meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh") + text: catalog.i18nc("@action:button", "Select settings"); + + style: ButtonStyle { - settingPickDialog.additional_excluded_settings = base.all_categories_except_support; + background: Rectangle + { + width: control.width; + height: control.height; + border.width: UM.Theme.getSize("default_lining").width; + border.color: control.pressed ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + color: control.pressed ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + } + label: Label + { + text: control.text; + color: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default") + anchors.centerIn: parent + } } - else + + onClicked: { - settingPickDialog.additional_excluded_settings = [] + settingPickDialog.visible = true; + if (meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh") + { + settingPickDialog.additional_excluded_settings = base.all_categories_except_support; + } + else + { + settingPickDialog.additional_excluded_settings = [] + } } } } + } - - UM.Dialog { - id: settingPickDialog - - title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") - width: screenScaleFactor * 360 - - property var additional_excluded_settings - - onVisibilityChanged: - { - // force updating the model to sync it with addedSettingsModel - if(visible) - { - // Set skip setting, it will prevent from resetting selected mesh_type - contents.model.visibilityHandler.addSkipResetSetting(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type) - listview.model.forceUpdate() - - updateFilter() - } - } - - function updateFilter() - { - var new_filter = {}; - new_filter["settable_per_mesh"] = true; - // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` - // is set to "one_at_a_time", because the current backend architecture isn't ready for that. - - if(filterInput.text != "") - { - new_filter["i18n_label"] = "*" + filterInput.text; - } - - listview.model.filter = new_filter; - } - - TextField { - id: filterInput - - anchors { - top: parent.top - left: parent.left - right: toggleShowAll.left - rightMargin: UM.Theme.getSize("default_margin").width - } - - placeholderText: catalog.i18nc("@label:textbox", "Filter..."); - - onTextChanged: settingPickDialog.updateFilter() - } - - CheckBox - { - id: toggleShowAll - - anchors { - top: parent.top - right: parent.right - } - - text: catalog.i18nc("@label:checkbox", "Show all") - checked: listview.model.showAll - onClicked: - { - listview.model.showAll = checked; - } - } + Column // Settings Dialog + { + // 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) + id: currentSettings + property int maximumHeight: 200 * screenScaleFactor + height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) + visible: current_mesh_type != "anti_overhang_mesh" ScrollView { - id: scrollView + height: parent.height + width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width + style: UM.Theme.styles.scrollview - anchors - { - top: filterInput.bottom; - left: parent.left; - right: parent.right; - bottom: parent.bottom; - } ListView { - id:listview + id: contents + spacing: UM.Theme.getSize("default_lining").height + model: UM.SettingDefinitionsModel { - id: definitionsModel; + id: addedSettingsModel; containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - visibilityHandler: UM.SettingPreferenceVisibilityHandler {} expanded: [ "*" ] + filter: + { + if (printSequencePropertyProvider.properties.value == "one_at_a_time") + { + return {"settable_per_meshgroup": true}; + } + return {"settable_per_mesh": true}; + } exclude: { - var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]; - excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings); + var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]; + + if(current_mesh_type == "support_mesh") + { + excluded_settings = excluded_settings.concat(base.all_categories_except_support); + } return excluded_settings; } - } - delegate:Loader - { - id: loader - width: parent.width - height: model.type != undefined ? UM.Theme.getSize("section").height : 0; - - property var definition: model - property var settingDefinitionsModel: definitionsModel - - asynchronous: true - source: + visibilityHandler: Cura.PerObjectSettingVisibilityHandler { - switch(model.type) + selectedObjectId: UM.ActiveTool.properties.getValue("SelectedObjectId") + } + + // For some reason the model object is updated after removing him from the memory and + // it happens only on Windows. For this reason, set the destroyed value manually. + Component.onDestruction: { + setDestroyed(true); + } + } + + delegate: Row + { + spacing: - UM.Theme.getSize("default_margin").width + Loader + { + id: settingLoader + width: UM.Theme.getSize("setting").width + height: UM.Theme.getSize("section").height + + property var definition: model + property var settingDefinitionsModel: addedSettingsModel + property var propertyProvider: provider + property var globalPropertyProvider: inheritStackProvider + property var externalResetHandler: false + + //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 + //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, + //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. + asynchronous: model.type != "enum" && model.type != "extruder" + + onLoaded: { + settingLoader.item.showRevertButton = false + settingLoader.item.showInheritButton = false + settingLoader.item.showLinkedSettingIcon = false + settingLoader.item.doDepthIndentation = false + settingLoader.item.doQualityUserSettingEmphasis = false + } + + sourceComponent: { - case "category": - return "PerObjectCategory.qml" - default: - return "PerObjectItem.qml" + switch(model.type) + { + case "int": + return settingTextField + case "[int]": + return settingTextField + case "float": + return settingTextField + case "enum": + return settingComboBox + case "extruder": + return settingExtruder + case "optional_extruder": + return settingOptionalExtruder + case "bool": + return settingCheckBox + case "str": + return settingTextField + case "category": + return settingCategory + default: + return settingUnknown + } + } + } + + Button + { + width: Math.round(UM.Theme.getSize("setting").height / 2) + height: UM.Theme.getSize("setting").height + + onClicked: addedSettingsModel.setVisible(model.key, false) + + style: ButtonStyle + { + background: Item + { + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + width: parent.width + height: width + sourceSize.height: width + color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") + source: UM.Theme.getIcon("minus") + } + } + } + } + + // Specialty provider that only watches global_inherits (we cant filter on what property changed we get events + // so we bypass that to make a dedicated provider). + UM.SettingPropertyProvider + { + id: provider + + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") + key: model.key + watchedProperties: [ "value", "enabled", "validationState" ] + storeIndex: 0 + removeUnusedValue: false + } + + UM.SettingPropertyProvider + { + id: inheritStackProvider + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") + key: model.key + watchedProperties: [ "limit_to_extruder" ] + } + + Connections + { + target: inheritStackProvider + onPropertiesChanged: + { + provider.forcePropertiesChanged(); + } + } + + Connections + { + target: UM.ActiveTool + onPropertiesChanged: + { + // the values cannot be bound with UM.ActiveTool.properties.getValue() calls, + // so here we connect to the signal and update the those values. + if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") + { + const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId"); + if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) + { + addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId; + } + } + if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") + { + const containerId = UM.ActiveTool.properties.getValue("ContainerID"); + if (provider.containerStackId != containerId) + { + provider.containerStackId = containerId; + } + if (inheritStackProvider.containerStackId != containerId) + { + inheritStackProvider.containerStackId = containerId; + } + } } } } - Component.onCompleted: settingPickDialog.updateFilter() + } } } - rightButtons: [ - Button { - text: catalog.i18nc("@action:button", "Close"); - onClicked: { - settingPickDialog.visible = false; + UM.Dialog + { + id: settingPickDialog + + title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") + width: screenScaleFactor * 360 + + property var additional_excluded_settings + + onVisibilityChanged: + { + // force updating the model to sync it with addedSettingsModel + if(visible) + { + // Set skip setting, it will prevent from resetting selected mesh_type + contents.model.visibilityHandler.addSkipResetSetting(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type) + listview.model.forceUpdate() + + updateFilter() } } - ] - } + + function updateFilter() + { + var new_filter = {}; + new_filter["settable_per_mesh"] = true; + // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` + // is set to "one_at_a_time", because the current backend architecture isn't ready for that. + + if(filterInput.text != "") + { + new_filter["i18n_label"] = "*" + filterInput.text; + } + + listview.model.filter = new_filter; + } + + TextField { + id: filterInput + + anchors { + top: parent.top + left: parent.left + right: toggleShowAll.left + rightMargin: UM.Theme.getSize("default_margin").width + } + + placeholderText: catalog.i18nc("@label:textbox", "Filter..."); + + onTextChanged: settingPickDialog.updateFilter() + } + + CheckBox + { + id: toggleShowAll + + anchors { + top: parent.top + right: parent.right + } + + text: catalog.i18nc("@label:checkbox", "Show all") + checked: listview.model.showAll + onClicked: + { + listview.model.showAll = checked; + } + } + + ScrollView + { + id: scrollView + + anchors + { + top: filterInput.bottom; + left: parent.left; + right: parent.right; + bottom: parent.bottom; + } + ListView + { + id:listview + model: UM.SettingDefinitionsModel + { + id: definitionsModel; + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + visibilityHandler: UM.SettingPreferenceVisibilityHandler {} + expanded: [ "*" ] + exclude: + { + var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]; + excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings); + return excluded_settings; + } + } + delegate:Loader + { + id: loader + + width: parent.width + height: model.type != undefined ? UM.Theme.getSize("section").height : 0; + + property var definition: model + property var settingDefinitionsModel: definitionsModel + + asynchronous: true + source: + { + switch(model.type) + { + case "category": + return "PerObjectCategory.qml" + default: + return "PerObjectItem.qml" + } + } + } + Component.onCompleted: settingPickDialog.updateFilter() + } + } + + rightButtons: [ + Button { + text: catalog.i18nc("@action:button", "Close"); + onClicked: { + settingPickDialog.visible = false; + } + } + ] + } UM.SettingPropertyProvider { @@ -583,4 +615,5 @@ Item { Cura.SettingUnknown { } } + } From 812eeab07acea4206bcaecc61c2e156f323c05a8 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 9 Sep 2019 16:46:46 +0200 Subject: [PATCH 06/25] Show infill checkbox only for overhang mesh types --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 188101817c..3aef3cc69b 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -158,7 +158,8 @@ Item style: UM.Theme.styles.checkbox; - checked: base.current_mesh_type === base.infill_mesh_type + checked: current_mesh_type === infill_mesh_type + visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type onClicked: base.setOverhangsMeshType() } } From 6101afa68b4e1d976b833336ce4575ba00ab5b28 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 9 Sep 2019 16:48:24 +0200 Subject: [PATCH 07/25] Remove redundant namespace usages --- .../PerObjectSettingsTool/PerObjectSettingsPanel.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 3aef3cc69b..512eeaa29b 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -87,7 +87,7 @@ Item iconSource: UM.Theme.getIcon("pos_normal"); property bool needBorder: true checkable: true - onClicked: base.setMeshType(normal_mesh_type); + onClicked: setMeshType(normal_mesh_type); style: UM.Theme.styles.tool_button; z: 4 } @@ -99,7 +99,7 @@ Item iconSource: UM.Theme.getIcon("pos_print_as_support"); property bool needBorder: true checkable:true - onClicked: base.setMeshType(support_mesh_type) + onClicked: setMeshType(support_mesh_type) style: UM.Theme.styles.tool_button; z: 3 } @@ -111,7 +111,7 @@ Item iconSource: UM.Theme.getIcon("pos_modify_overlaps"); property bool needBorder: true checkable:true - onClicked: base.setMeshType(infill_mesh_type) + onClicked: setMeshType(infill_mesh_type) style: UM.Theme.styles.tool_button; z: 2 } @@ -123,7 +123,7 @@ Item iconSource: UM.Theme.getIcon("pos_modify_dont_support_overlap"); property bool needBorder: true checkable: true - onClicked: base.setMeshType(anti_overhang_mesh_type) + onClicked: setMeshType(anti_overhang_mesh_type) style: UM.Theme.styles.tool_button; z: 1 } @@ -160,7 +160,7 @@ Item checked: current_mesh_type === infill_mesh_type visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type - onClicked: base.setOverhangsMeshType() + onClicked: setOverhangsMeshType() } } From 80569c2f51260f538a856fc07721ade9deb47959 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 9 Sep 2019 17:04:17 +0200 Subject: [PATCH 08/25] Update Per Object Settings Overhangs icon --- .../themes/cura-light/icons/pos_modify_overlaps.svg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/themes/cura-light/icons/pos_modify_overlaps.svg b/resources/themes/cura-light/icons/pos_modify_overlaps.svg index 3ad69c05c3..a664e820a6 100644 --- a/resources/themes/cura-light/icons/pos_modify_overlaps.svg +++ b/resources/themes/cura-light/icons/pos_modify_overlaps.svg @@ -1,17 +1,17 @@ - + pms_modify_overlaps Created with Sketch. - - + + - - - + + + \ No newline at end of file From 0ba1bfbe4f3f629c382252687399ca4cdcdcf957 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 9 Sep 2019 17:12:15 +0200 Subject: [PATCH 09/25] Enable Per Object Settings when extruder is in Recommended mode --- .../PerObjectSettingsTool/PerObjectSettingsTool.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py index baa700165c..6998419b9b 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py @@ -20,15 +20,11 @@ class PerObjectSettingsTool(Tool): self.setExposedProperties("SelectedObjectId", "ContainerID", "SelectedActiveExtruder", "MeshType") - self._advanced_mode = False self._multi_extrusion = False self._single_model_selected = False Selection.selectionChanged.connect(self.propertyChanged) - Application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferenceChanged) - self._onPreferenceChanged("cura/active_mode") - Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged) self._onGlobalContainerChanged() Selection.selectionChanged.connect(self._updateEnabled) @@ -103,11 +99,6 @@ class PerObjectSettingsTool(Tool): return "" - def _onPreferenceChanged(self, preference): - if preference == "cura/active_mode": - self._advanced_mode = Application.getInstance().getPreferences().getValue(preference) == 1 - self._updateEnabled() - def _onGlobalContainerChanged(self): global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack: @@ -140,4 +131,4 @@ class PerObjectSettingsTool(Tool): self._single_model_selected = False # Group is selected, so tool needs to be disabled else: self._single_model_selected = True - Application.getInstance().getController().toolEnabledChanged.emit(self._plugin_id, self._advanced_mode and self._single_model_selected) + Application.getInstance().getController().toolEnabledChanged.emit(self._plugin_id, self._single_model_selected) From 42a3e1227aa83455dab9e8ca4fc3b1d98fc124ce Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Tue, 10 Sep 2019 13:36:26 +0200 Subject: [PATCH 10/25] Use explicit types for mesh_type qml properties CURA-6683 --- .../PerObjectSettingsTool/PerObjectSettingsPanel.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 512eeaa29b..f0afcef298 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -18,11 +18,11 @@ Item property var all_categories_except_support: [ "machine_settings", "resolution", "shell", "infill", "material", "speed", "travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"] - readonly property var normal_mesh_type: "" - readonly property var support_mesh_type: "support_mesh" - readonly property var cutting_mesh_type: "cutting_mesh" - readonly property var infill_mesh_type: "infill_mesh" - readonly property var anti_overhang_mesh_type: "anti_overhang_mesh" + readonly property string normal_mesh_type: "" + readonly property string support_mesh_type: "support_mesh" + readonly property string cutting_mesh_type: "cutting_mesh" + readonly property string infill_mesh_type: "infill_mesh" + readonly property string anti_overhang_mesh_type: "anti_overhang_mesh" property var current_mesh_type: normal_mesh_type From 184a72f7ab2ae7e47de659c33e72c25b851d1d76 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 10:55:05 +0200 Subject: [PATCH 11/25] Bind current_mesh_type to UM.ActiveTool.properties.getValue("MeshType") CURA-6683 --- .../PerObjectSettingsPanel.qml | 20 +++++++------------ .../PerObjectSettingsTool.py | 9 ++++++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index f0afcef298..579538cb12 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -24,11 +24,11 @@ Item readonly property string infill_mesh_type: "infill_mesh" readonly property string anti_overhang_mesh_type: "anti_overhang_mesh" - property var current_mesh_type: normal_mesh_type + property var current_mesh_type: UM.ActiveTool.properties.getValue("MeshType") function setOverhangsMeshType(){ - if(infillOnlyCheckbox.checked) + if (infillOnlyCheckbox.checked) { setMeshType(infill_mesh_type) } @@ -39,19 +39,13 @@ Item } function setMeshType(type) { - current_mesh_type = type - - // update the active object - if(UM.ActiveTool.properties.getValue("MeshType") !== type) - { - UM.ActiveTool.setProperty("MeshType", type) - } + UM.ActiveTool.setProperty("MeshType", type) // set checked state of mesh type buttons - normalButton.checked = current_mesh_type === normal_mesh_type - supportMeshButton.checked = current_mesh_type === support_mesh_type - overhangMeshButton.checked = current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type - antiOverhangMeshButton.checked = current_mesh_type === anti_overhang_mesh_type + normalButton.checked = type === normal_mesh_type + supportMeshButton.checked = type === support_mesh_type + overhangMeshButton.checked = type === infill_mesh_type || type === cutting_mesh_type + antiOverhangMeshButton.checked = type === anti_overhang_mesh_type // update active type label for (var button in meshTypeButtons.children) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py index 6998419b9b..0581deb496 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py @@ -66,7 +66,11 @@ class PerObjectSettingsTool(Tool): selected_object.addDecorator(SettingOverrideDecorator()) selected_object.callDecoration("setActiveExtruder", extruder_stack_id) - def setMeshType(self, mesh_type): + ## Returns True when the mesh_type was changed, False when current mesh_type == mesh_type + def setMeshType(self, mesh_type) -> bool: + if self.getMeshType() == mesh_type: + return False + selected_object = Selection.getSelectedObject(0) stack = selected_object.callDecoration("getStack") #Don't try to get the active extruder since it may be None anyway. if not stack: @@ -86,6 +90,9 @@ class PerObjectSettingsTool(Tool): new_instance.resetState() # Ensure that the state is not seen as a user state. settings.addInstance(new_instance) + self.propertyChanged.emit() + return True + def getMeshType(self): selected_object = Selection.getSelectedObject(0) stack = selected_object.callDecoration("getStack") #Don't try to get the active extruder since it may be None anyway. From 90fefac37fa1231ed48f1f1f9ca6144cfa4f1722 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 11:06:11 +0200 Subject: [PATCH 12/25] Remove redundant rows from POS QML CuRA-6683 --- .../PerObjectSettingsPanel.qml | 109 ++++++++---------- 1 file changed, 46 insertions(+), 63 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 579538cb12..19dad72bd9 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -124,84 +124,67 @@ Item } - Row // Selected mesh type label + Label { - spacing: UM.Theme.getSize("default_margin").width - - Label - { - id: meshTypeLabel - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - height: UM.Theme.getSize("setting").height - verticalAlignment: Text.AlignVCenter - } - + id: meshTypeLabel + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + height: UM.Theme.getSize("setting").height + verticalAlignment: Text.AlignVCenter } - Row // Infill-only checkbox (visible for overhang mesh button) + CheckBox { - spacing: UM.Theme.getSize("default_margin").width + id: infillOnlyCheckbox + text: catalog.i18nc("@action:checkbox","Infill only"); - CheckBox - { - id: infillOnlyCheckbox + style: UM.Theme.styles.checkbox; - text: catalog.i18nc("@action:checkbox","Infill only"); - - style: UM.Theme.styles.checkbox; - - checked: current_mesh_type === infill_mesh_type - visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type - onClicked: setOverhangsMeshType() - } + checked: current_mesh_type === infill_mesh_type + visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type + onClicked: setOverhangsMeshType() } - Row + Button { - spacing: UM.Theme.getSize("default_margin").width + id: customiseSettingsButton; + height: UM.Theme.getSize("setting_control").height; + visible: currentSettings.visible - Button + text: catalog.i18nc("@action:button", "Select settings"); + + style: ButtonStyle { - id: customiseSettingsButton; - height: UM.Theme.getSize("setting_control").height; - visible: currentSettings.visible - - text: catalog.i18nc("@action:button", "Select settings"); - - style: ButtonStyle + background: Rectangle { - background: Rectangle - { - width: control.width; - height: control.height; - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.pressed ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - color: control.pressed ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - label: Label - { - text: control.text; - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default") - anchors.centerIn: parent - } + width: control.width; + height: control.height; + border.width: UM.Theme.getSize("default_lining").width; + border.color: control.pressed ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + color: control.pressed ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") } - - onClicked: + label: Label { - settingPickDialog.visible = true; - if (meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh") - { - settingPickDialog.additional_excluded_settings = base.all_categories_except_support; - } - else - { - settingPickDialog.additional_excluded_settings = [] - } + text: control.text; + color: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default") + anchors.centerIn: parent + } + } + + onClicked: + { + settingPickDialog.visible = true; + if (meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh") + { + settingPickDialog.additional_excluded_settings = base.all_categories_except_support; + } + else + { + settingPickDialog.additional_excluded_settings = [] } } } From fe0e1e5aba3afdff5ab482ebecfe9a8997f3205a Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 11:17:07 +0200 Subject: [PATCH 13/25] Remove unnecessary ; line endings in QML CURA-6683 --- .../PerObjectSettingsPanel.qml | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 19dad72bd9..23f2c63415 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -213,26 +213,26 @@ Item model: UM.SettingDefinitionsModel { - id: addedSettingsModel; + id: addedSettingsModel containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" expanded: [ "*" ] filter: { if (printSequencePropertyProvider.properties.value == "one_at_a_time") { - return {"settable_per_meshgroup": true}; + return {"settable_per_meshgroup": true} } - return {"settable_per_mesh": true}; + return {"settable_per_mesh": true} } exclude: { - var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]; + var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] if(current_mesh_type == "support_mesh") { - excluded_settings = excluded_settings.concat(base.all_categories_except_support); + excluded_settings = excluded_settings.concat(base.all_categories_except_support) } - return excluded_settings; + return excluded_settings } visibilityHandler: Cura.PerObjectSettingVisibilityHandler @@ -243,7 +243,7 @@ Item // For some reason the model object is updated after removing him from the memory and // it happens only on Windows. For this reason, set the destroyed value manually. Component.onDestruction: { - setDestroyed(true); + setDestroyed(true) } } @@ -353,7 +353,7 @@ Item target: inheritStackProvider onPropertiesChanged: { - provider.forcePropertiesChanged(); + provider.forcePropertiesChanged() } } @@ -366,22 +366,22 @@ Item // so here we connect to the signal and update the those values. if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") { - const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId"); + const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId") if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) { - addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId; + addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId } } if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") { - const containerId = UM.ActiveTool.properties.getValue("ContainerID"); + const containerId = UM.ActiveTool.properties.getValue("ContainerID") if (provider.containerStackId != containerId) { - provider.containerStackId = containerId; + provider.containerStackId = containerId } if (inheritStackProvider.containerStackId != containerId) { - inheritStackProvider.containerStackId = containerId; + inheritStackProvider.containerStackId = containerId } } } @@ -415,17 +415,17 @@ Item function updateFilter() { - var new_filter = {}; - new_filter["settable_per_mesh"] = true; + var new_filter = {} + new_filter["settable_per_mesh"] = true // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` // is set to "one_at_a_time", because the current backend architecture isn't ready for that. if(filterInput.text != "") { - new_filter["i18n_label"] = "*" + filterInput.text; + new_filter["i18n_label"] = "*" + filterInput.text } - listview.model.filter = new_filter; + listview.model.filter = new_filter } TextField { @@ -438,7 +438,7 @@ Item rightMargin: UM.Theme.getSize("default_margin").width } - placeholderText: catalog.i18nc("@label:textbox", "Filter..."); + placeholderText: catalog.i18nc("@label:textbox", "Filter...") onTextChanged: settingPickDialog.updateFilter() } @@ -456,7 +456,7 @@ Item checked: listview.model.showAll onClicked: { - listview.model.showAll = checked; + listview.model.showAll = checked } } @@ -466,25 +466,25 @@ Item anchors { - top: filterInput.bottom; - left: parent.left; - right: parent.right; - bottom: parent.bottom; + top: filterInput.bottom + left: parent.left + right: parent.right + bottom: parent.bottom } ListView { id:listview model: UM.SettingDefinitionsModel { - id: definitionsModel; + id: definitionsModel containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" visibilityHandler: UM.SettingPreferenceVisibilityHandler {} expanded: [ "*" ] exclude: { - var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]; - excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings); - return excluded_settings; + var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] + excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) + return excluded_settings } } delegate:Loader @@ -492,7 +492,7 @@ Item id: loader width: parent.width - height: model.type != undefined ? UM.Theme.getSize("section").height : 0; + height: model.type != undefined ? UM.Theme.getSize("section").height : 0 property var definition: model property var settingDefinitionsModel: definitionsModel @@ -515,9 +515,9 @@ Item rightButtons: [ Button { - text: catalog.i18nc("@action:button", "Close"); + text: catalog.i18nc("@action:button", "Close") onClicked: { - settingPickDialog.visible = false; + settingPickDialog.visible = false } } ] @@ -543,25 +543,25 @@ Item storeIndex: 0 } - SystemPalette { id: palette; } + SystemPalette { id: palette } Component { - id: settingTextField; + id: settingTextField Cura.SettingTextField { } } Component { - id: settingComboBox; + id: settingComboBox Cura.SettingComboBox { } } Component { - id: settingExtruder; + id: settingExtruder Cura.SettingExtruder { } } @@ -575,21 +575,21 @@ Item Component { - id: settingCheckBox; + id: settingCheckBox Cura.SettingCheckBox { } } Component { - id: settingCategory; + id: settingCategory Cura.SettingCategory { } } Component { - id: settingUnknown; + id: settingUnknown Cura.SettingUnknown { } } From 606faf54c2fd67475f53c113951f59ac0f997b5f Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 12:01:48 +0200 Subject: [PATCH 14/25] Remove unnecessary component initialization CURA-6683 --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 23f2c63415..79ac52c72a 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -27,6 +27,8 @@ Item property var current_mesh_type: UM.ActiveTool.properties.getValue("MeshType") + onCurrent_mesh_typeChanged: updateView(current_mesh_type) + function setOverhangsMeshType(){ if (infillOnlyCheckbox.checked) { @@ -38,8 +40,11 @@ Item } } - function setMeshType(type) { + function setMeshType(type){ UM.ActiveTool.setProperty("MeshType", type) + } + + function updateView(type) { // set checked state of mesh type buttons normalButton.checked = type === normal_mesh_type @@ -67,8 +72,6 @@ Item spacing: UM.Theme.getSize("default_margin").height - Component.onCompleted: setMeshType(UM.ActiveTool.properties.getValue("MeshType")) - Row // Mesh type buttons { id: meshTypeButtons From 667e5f8e18afd03220b143b3357eb9d317ee47a8 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 13:16:16 +0200 Subject: [PATCH 15/25] Fix reference error in POS CURA-6683 --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 79ac52c72a..fca16c4fbf 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -181,7 +181,7 @@ Item onClicked: { settingPickDialog.visible = true; - if (meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh") + if (current_mesh_type == "support_mesh") { settingPickDialog.additional_excluded_settings = base.all_categories_except_support; } @@ -409,7 +409,7 @@ Item if(visible) { // Set skip setting, it will prevent from resetting selected mesh_type - contents.model.visibilityHandler.addSkipResetSetting(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type) + contents.model.visibilityHandler.addSkipResetSetting(current_mesh_type) listview.model.forceUpdate() updateFilter() From 44fbcaeb3a437bb349ba435134445cf75695413f Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 13:24:17 +0200 Subject: [PATCH 16/25] Fix Settings lines positioning for Per Object Settings CURA-6683 --- .../PerObjectSettingsPanel.qml | 610 +++++++++--------- 1 file changed, 306 insertions(+), 304 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index fca16c4fbf..d3129a5078 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -41,10 +41,12 @@ Item } function setMeshType(type){ + print("setting mesh type to " + type) UM.ActiveTool.setProperty("MeshType", type) } function updateView(type) { + print("updating view for type " + type) // set checked state of mesh type buttons normalButton.checked = type === normal_mesh_type @@ -149,6 +151,206 @@ Item onClicked: setOverhangsMeshType() } + Column // Settings Dialog + { + // 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) + id: currentSettings + property int maximumHeight: 200 * screenScaleFactor + height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) + visible: current_mesh_type != "anti_overhang_mesh" + + ScrollView + { + height: parent.height + width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width + style: UM.Theme.styles.scrollview + + ListView + { + id: contents + spacing: UM.Theme.getSize("default_lining").height + + model: UM.SettingDefinitionsModel + { + id: addedSettingsModel + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + expanded: [ "*" ] + filter: + { + if (printSequencePropertyProvider.properties.value == "one_at_a_time") + { + return {"settable_per_meshgroup": true} + } + return {"settable_per_mesh": true} + } + exclude: + { + var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] + + if(current_mesh_type == "support_mesh") + { + excluded_settings = excluded_settings.concat(base.all_categories_except_support) + } + return excluded_settings + } + + visibilityHandler: Cura.PerObjectSettingVisibilityHandler + { + selectedObjectId: UM.ActiveTool.properties.getValue("SelectedObjectId") + } + + // For some reason the model object is updated after removing him from the memory and + // it happens only on Windows. For this reason, set the destroyed value manually. + Component.onDestruction: { + setDestroyed(true) + } + } + + delegate: Row + { + spacing: - UM.Theme.getSize("default_margin").width + Loader + { + id: settingLoader + width: UM.Theme.getSize("setting").width + height: UM.Theme.getSize("section").height + + property var definition: model + property var settingDefinitionsModel: addedSettingsModel + property var propertyProvider: provider + property var globalPropertyProvider: inheritStackProvider + property var externalResetHandler: false + + //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 + //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, + //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. + asynchronous: model.type != "enum" && model.type != "extruder" + + onLoaded: { + settingLoader.item.showRevertButton = false + settingLoader.item.showInheritButton = false + settingLoader.item.showLinkedSettingIcon = false + settingLoader.item.doDepthIndentation = false + settingLoader.item.doQualityUserSettingEmphasis = false + } + + sourceComponent: + { + switch(model.type) + { + case "int": + return settingTextField + case "[int]": + return settingTextField + case "float": + return settingTextField + case "enum": + return settingComboBox + case "extruder": + return settingExtruder + case "optional_extruder": + return settingOptionalExtruder + case "bool": + return settingCheckBox + case "str": + return settingTextField + case "category": + return settingCategory + default: + return settingUnknown + } + } + } + + Button + { + width: Math.round(UM.Theme.getSize("setting").height / 2) + height: UM.Theme.getSize("setting").height + + onClicked: addedSettingsModel.setVisible(model.key, false) + + style: ButtonStyle + { + background: Item + { + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + width: parent.width + height: width + sourceSize.height: width + color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") + source: UM.Theme.getIcon("minus") + } + } + } + } + + // Specialty provider that only watches global_inherits (we cant filter on what property changed we get events + // so we bypass that to make a dedicated provider). + UM.SettingPropertyProvider + { + id: provider + + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") + key: model.key + watchedProperties: [ "value", "enabled", "validationState" ] + storeIndex: 0 + removeUnusedValue: false + } + + UM.SettingPropertyProvider + { + id: inheritStackProvider + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") + key: model.key + watchedProperties: [ "limit_to_extruder" ] + } + + Connections + { + target: inheritStackProvider + onPropertiesChanged: + { + provider.forcePropertiesChanged() + } + } + + Connections + { + target: UM.ActiveTool + onPropertiesChanged: + { + // the values cannot be bound with UM.ActiveTool.properties.getValue() calls, + // so here we connect to the signal and update the those values. + if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") + { + const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId") + if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) + { + addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId + } + } + if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") + { + const containerId = UM.ActiveTool.properties.getValue("ContainerID") + if (provider.containerStackId != containerId) + { + provider.containerStackId = containerId + } + if (inheritStackProvider.containerStackId != containerId) + { + inheritStackProvider.containerStackId = containerId + } + } + } + } + } + } + } + } + Button { id: customiseSettingsButton; @@ -194,337 +396,137 @@ Item } - Column // Settings Dialog + UM.Dialog { - // 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) - id: currentSettings - property int maximumHeight: 200 * screenScaleFactor - height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) - visible: current_mesh_type != "anti_overhang_mesh" + id: settingPickDialog + + title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") + width: screenScaleFactor * 360 + + property var additional_excluded_settings + + onVisibilityChanged: + { + // force updating the model to sync it with addedSettingsModel + if(visible) + { + // Set skip setting, it will prevent from resetting selected mesh_type + contents.model.visibilityHandler.addSkipResetSetting(current_mesh_type) + listview.model.forceUpdate() + + updateFilter() + } + } + + function updateFilter() + { + var new_filter = {} + new_filter["settable_per_mesh"] = true + // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` + // is set to "one_at_a_time", because the current backend architecture isn't ready for that. + + if(filterInput.text != "") + { + new_filter["i18n_label"] = "*" + filterInput.text + } + + listview.model.filter = new_filter + } + + TextField { + id: filterInput + + anchors { + top: parent.top + left: parent.left + right: toggleShowAll.left + rightMargin: UM.Theme.getSize("default_margin").width + } + + placeholderText: catalog.i18nc("@label:textbox", "Filter...") + + onTextChanged: settingPickDialog.updateFilter() + } + + CheckBox + { + id: toggleShowAll + + anchors { + top: parent.top + right: parent.right + } + + text: catalog.i18nc("@label:checkbox", "Show all") + checked: listview.model.showAll + onClicked: + { + listview.model.showAll = checked + } + } ScrollView { - height: parent.height - width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width - style: UM.Theme.styles.scrollview + id: scrollView + anchors + { + top: filterInput.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } ListView { - id: contents - spacing: UM.Theme.getSize("default_lining").height - + id:listview model: UM.SettingDefinitionsModel { - id: addedSettingsModel + id: definitionsModel containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + visibilityHandler: UM.SettingPreferenceVisibilityHandler {} expanded: [ "*" ] - filter: - { - if (printSequencePropertyProvider.properties.value == "one_at_a_time") - { - return {"settable_per_meshgroup": true} - } - return {"settable_per_mesh": true} - } exclude: { - var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - - if(current_mesh_type == "support_mesh") - { - excluded_settings = excluded_settings.concat(base.all_categories_except_support) - } + var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] + excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) return excluded_settings } - - visibilityHandler: Cura.PerObjectSettingVisibilityHandler - { - selectedObjectId: UM.ActiveTool.properties.getValue("SelectedObjectId") - } - - // For some reason the model object is updated after removing him from the memory and - // it happens only on Windows. For this reason, set the destroyed value manually. - Component.onDestruction: { - setDestroyed(true) - } } - - delegate: Row + delegate:Loader { - spacing: - UM.Theme.getSize("default_margin").width - Loader + id: loader + + width: parent.width + height: model.type != undefined ? UM.Theme.getSize("section").height : 0 + + property var definition: model + property var settingDefinitionsModel: definitionsModel + + asynchronous: true + source: { - id: settingLoader - width: UM.Theme.getSize("setting").width - height: UM.Theme.getSize("section").height - - property var definition: model - property var settingDefinitionsModel: addedSettingsModel - property var propertyProvider: provider - property var globalPropertyProvider: inheritStackProvider - property var externalResetHandler: false - - //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 - //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, - //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" && model.type != "extruder" - - onLoaded: { - settingLoader.item.showRevertButton = false - settingLoader.item.showInheritButton = false - settingLoader.item.showLinkedSettingIcon = false - settingLoader.item.doDepthIndentation = false - settingLoader.item.doQualityUserSettingEmphasis = false - } - - sourceComponent: + switch(model.type) { - switch(model.type) - { - case "int": - return settingTextField - case "[int]": - return settingTextField - case "float": - return settingTextField - case "enum": - return settingComboBox - case "extruder": - return settingExtruder - case "optional_extruder": - return settingOptionalExtruder - case "bool": - return settingCheckBox - case "str": - return settingTextField - case "category": - return settingCategory - default: - return settingUnknown - } - } - } - - Button - { - width: Math.round(UM.Theme.getSize("setting").height / 2) - height: UM.Theme.getSize("setting").height - - onClicked: addedSettingsModel.setVisible(model.key, false) - - style: ButtonStyle - { - background: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - height: width - sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") - source: UM.Theme.getIcon("minus") - } - } - } - } - - // Specialty provider that only watches global_inherits (we cant filter on what property changed we get events - // so we bypass that to make a dedicated provider). - UM.SettingPropertyProvider - { - id: provider - - containerStackId: UM.ActiveTool.properties.getValue("ContainerID") - key: model.key - watchedProperties: [ "value", "enabled", "validationState" ] - storeIndex: 0 - removeUnusedValue: false - } - - UM.SettingPropertyProvider - { - id: inheritStackProvider - containerStackId: UM.ActiveTool.properties.getValue("ContainerID") - key: model.key - watchedProperties: [ "limit_to_extruder" ] - } - - Connections - { - target: inheritStackProvider - onPropertiesChanged: - { - provider.forcePropertiesChanged() - } - } - - Connections - { - target: UM.ActiveTool - onPropertiesChanged: - { - // the values cannot be bound with UM.ActiveTool.properties.getValue() calls, - // so here we connect to the signal and update the those values. - if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") - { - const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId") - if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) - { - addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId - } - } - if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") - { - const containerId = UM.ActiveTool.properties.getValue("ContainerID") - if (provider.containerStackId != containerId) - { - provider.containerStackId = containerId - } - if (inheritStackProvider.containerStackId != containerId) - { - inheritStackProvider.containerStackId = containerId - } - } + case "category": + return "PerObjectCategory.qml" + default: + return "PerObjectItem.qml" } } } - } + Component.onCompleted: settingPickDialog.updateFilter() } } - UM.Dialog - { - id: settingPickDialog - - title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") - width: screenScaleFactor * 360 - - property var additional_excluded_settings - - onVisibilityChanged: - { - // force updating the model to sync it with addedSettingsModel - if(visible) - { - // Set skip setting, it will prevent from resetting selected mesh_type - contents.model.visibilityHandler.addSkipResetSetting(current_mesh_type) - listview.model.forceUpdate() - - updateFilter() + rightButtons: [ + Button { + text: catalog.i18nc("@action:button", "Close") + onClicked: { + settingPickDialog.visible = false } } - - function updateFilter() - { - var new_filter = {} - new_filter["settable_per_mesh"] = true - // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` - // is set to "one_at_a_time", because the current backend architecture isn't ready for that. - - if(filterInput.text != "") - { - new_filter["i18n_label"] = "*" + filterInput.text - } - - listview.model.filter = new_filter - } - - TextField { - id: filterInput - - anchors { - top: parent.top - left: parent.left - right: toggleShowAll.left - rightMargin: UM.Theme.getSize("default_margin").width - } - - placeholderText: catalog.i18nc("@label:textbox", "Filter...") - - onTextChanged: settingPickDialog.updateFilter() - } - - CheckBox - { - id: toggleShowAll - - anchors { - top: parent.top - right: parent.right - } - - text: catalog.i18nc("@label:checkbox", "Show all") - checked: listview.model.showAll - onClicked: - { - listview.model.showAll = checked - } - } - - ScrollView - { - id: scrollView - - anchors - { - top: filterInput.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - ListView - { - id:listview - model: UM.SettingDefinitionsModel - { - id: definitionsModel - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - visibilityHandler: UM.SettingPreferenceVisibilityHandler {} - expanded: [ "*" ] - exclude: - { - var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) - return excluded_settings - } - } - delegate:Loader - { - id: loader - - width: parent.width - height: model.type != undefined ? UM.Theme.getSize("section").height : 0 - - property var definition: model - property var settingDefinitionsModel: definitionsModel - - asynchronous: true - source: - { - switch(model.type) - { - case "category": - return "PerObjectCategory.qml" - default: - return "PerObjectItem.qml" - } - } - } - Component.onCompleted: settingPickDialog.updateFilter() - } - } - - rightButtons: [ - Button { - text: catalog.i18nc("@action:button", "Close") - onClicked: { - settingPickDialog.visible = false - } - } - ] - } + ] + } UM.SettingPropertyProvider { From d6872a65bde871a87d877be7e949e8896fffb445 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 13 Sep 2019 13:36:30 +0200 Subject: [PATCH 17/25] Fix infillOnlyCheckbox not representing mesh type Not a bug but a feature: When the overlays button is clicked, the infill mesh type is set and the checkbox checked CURA-6683 --- .../PerObjectSettingsTool/PerObjectSettingsPanel.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index d3129a5078..b5cc367b11 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -41,13 +41,10 @@ Item } function setMeshType(type){ - print("setting mesh type to " + type) UM.ActiveTool.setProperty("MeshType", type) } function updateView(type) { - print("updating view for type " + type) - // set checked state of mesh type buttons normalButton.checked = type === normal_mesh_type supportMeshButton.checked = type === support_mesh_type @@ -146,9 +143,14 @@ Item style: UM.Theme.styles.checkbox; - checked: current_mesh_type === infill_mesh_type visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type onClicked: setOverhangsMeshType() + + Binding { + target: infillOnlyCheckbox + property: "checked" + value: current_mesh_type === infill_mesh_type + } } Column // Settings Dialog From dbb9e55bc8de25107934a4a004d5b5727b087676 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 16 Sep 2019 15:05:02 +0200 Subject: [PATCH 18/25] Fix MyPy warning in PerObjectSettingsTool CURA-6683 --- plugins/PerObjectSettingsTool/PerObjectSettingsTool.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py index 0581deb496..b2eb925a6d 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py @@ -1,6 +1,6 @@ # Copyright (c) 2016 Ultimaker B.V. # Uranium is released under the terms of the LGPLv3 or higher. - +from UM.Logger import Logger from UM.Tool import Tool from UM.Scene.Selection import Selection from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator @@ -67,11 +67,15 @@ class PerObjectSettingsTool(Tool): selected_object.callDecoration("setActiveExtruder", extruder_stack_id) ## Returns True when the mesh_type was changed, False when current mesh_type == mesh_type - def setMeshType(self, mesh_type) -> bool: + def setMeshType(self, mesh_type: str) -> bool: if self.getMeshType() == mesh_type: return False selected_object = Selection.getSelectedObject(0) + if selected_object is None: + Logger.log("w", "Tried setting the mesh type of the selected object, but no object was selected") + return False + stack = selected_object.callDecoration("getStack") #Don't try to get the active extruder since it may be None anyway. if not stack: selected_object.addDecorator(SettingOverrideDecorator()) From 0b9052b068ef76760dc4bc493d25fe33d2d690ee Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 17 Sep 2019 15:12:46 +0200 Subject: [PATCH 19/25] Clean up and code style fixing Contributes to CURA-6683. --- .../PerObjectSettingsPanel.qml | 81 ++++++++++--------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index b5cc367b11..84ddbe2c66 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -24,12 +24,30 @@ Item readonly property string infill_mesh_type: "infill_mesh" readonly property string anti_overhang_mesh_type: "anti_overhang_mesh" - property var current_mesh_type: UM.ActiveTool.properties.getValue("MeshType") + property var currentMeshType: UM.ActiveTool.properties.getValue("MeshType") + // Update the view every time the currentMeshType changes + onCurrentMeshTypeChanged: + { + // set checked state of mesh type buttons + normalButton.checked = currentMeshType === normal_mesh_type + supportMeshButton.checked = currentMeshType === support_mesh_type + overhangMeshButton.checked = currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type + antiOverhangMeshButton.checked = currentMeshType === anti_overhang_mesh_type - onCurrent_mesh_typeChanged: updateView(current_mesh_type) + // update active type label + for (var button in meshTypeButtons.children) + { + if (meshTypeButtons.children[button].checked) + { + meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text + break + } + } + } - function setOverhangsMeshType(){ + function setOverhangsMeshType() + { if (infillOnlyCheckbox.checked) { setMeshType(infill_mesh_type) @@ -40,27 +58,11 @@ Item } } - function setMeshType(type){ + function setMeshType(type) + { UM.ActiveTool.setProperty("MeshType", type) } - function updateView(type) { - // set checked state of mesh type buttons - normalButton.checked = type === normal_mesh_type - supportMeshButton.checked = type === support_mesh_type - overhangMeshButton.checked = type === infill_mesh_type || type === cutting_mesh_type - antiOverhangMeshButton.checked = type === anti_overhang_mesh_type - - // update active type label - for (var button in meshTypeButtons.children) - { - if(meshTypeButtons.children[button].checked){ - meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text - break - } - } - } - UM.I18nCatalog { id: catalog; name: "uranium"} Column @@ -143,13 +145,14 @@ Item style: UM.Theme.styles.checkbox; - visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type + visible: currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type onClicked: setOverhangsMeshType() - Binding { + Binding + { target: infillOnlyCheckbox property: "checked" - value: current_mesh_type === infill_mesh_type + value: currentMeshType === infill_mesh_type } } @@ -160,7 +163,7 @@ Item id: currentSettings property int maximumHeight: 200 * screenScaleFactor height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) - visible: current_mesh_type != "anti_overhang_mesh" + visible: currentMeshType != "anti_overhang_mesh" ScrollView { @@ -190,7 +193,7 @@ Item { var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - if(current_mesh_type == "support_mesh") + if(currentMeshType == "support_mesh") { excluded_settings = excluded_settings.concat(base.all_categories_except_support) } @@ -204,7 +207,8 @@ Item // For some reason the model object is updated after removing him from the memory and // it happens only on Windows. For this reason, set the destroyed value manually. - Component.onDestruction: { + Component.onDestruction: + { setDestroyed(true) } } @@ -229,7 +233,8 @@ Item //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. asynchronous: model.type != "enum" && model.type != "extruder" - onLoaded: { + onLoaded: + { settingLoader.item.showRevertButton = false settingLoader.item.showInheritButton = false settingLoader.item.showLinkedSettingIcon = false @@ -385,7 +390,7 @@ Item onClicked: { settingPickDialog.visible = true; - if (current_mesh_type == "support_mesh") + if (currentMeshType == "support_mesh") { settingPickDialog.additional_excluded_settings = base.all_categories_except_support; } @@ -413,7 +418,7 @@ Item if(visible) { // Set skip setting, it will prevent from resetting selected mesh_type - contents.model.visibilityHandler.addSkipResetSetting(current_mesh_type) + contents.model.visibilityHandler.addSkipResetSetting(currentMeshType) listview.model.forceUpdate() updateFilter() @@ -435,10 +440,12 @@ Item listview.model.filter = new_filter } - TextField { + TextField + { id: filterInput - anchors { + anchors + { top: parent.top left: parent.left right: toggleShowAll.left @@ -454,7 +461,8 @@ Item { id: toggleShowAll - anchors { + anchors + { top: parent.top right: parent.right } @@ -521,11 +529,10 @@ Item } rightButtons: [ - Button { + Button + { text: catalog.i18nc("@action:button", "Close") - onClicked: { - settingPickDialog.visible = false - } + onClicked: settingPickDialog.visible = false } ] } From c3bbd884b5803e95c2bb23abec4de15701864a94 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 18 Sep 2019 09:33:17 +0200 Subject: [PATCH 20/25] Use Cura.SecondaryButton for POS select settings button per design CURA-6683 --- .../PerObjectSettingsPanel.qml | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 84ddbe2c66..540435003c 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -358,7 +358,7 @@ Item } } - Button + Cura.SecondaryButton { id: customiseSettingsButton; height: UM.Theme.getSize("setting_control").height; @@ -366,27 +366,6 @@ Item text: catalog.i18nc("@action:button", "Select settings"); - style: ButtonStyle - { - background: Rectangle - { - width: control.width; - height: control.height; - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.pressed ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - color: control.pressed ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - label: Label - { - text: control.text; - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default") - anchors.centerIn: parent - } - } - onClicked: { settingPickDialog.visible = true; From be7bd59e30c870a4118576ddbd1632f21f8808a6 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 18 Sep 2019 09:45:26 +0200 Subject: [PATCH 21/25] Code Style: camelCase for qnl properties, brackets, commas CURA-6683 --- .../PerObjectSettingsPanel.qml | 70 ++++++++++++------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 540435003c..74fecf0cee 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -15,14 +15,14 @@ Item id: base width: childrenRect.width height: childrenRect.height - property var all_categories_except_support: [ "machine_settings", "resolution", "shell", "infill", "material", "speed", + property var allCategoriesExceptSupport: [ "machine_settings", "resolution", "shell", "infill", "material", "speed", "travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"] - readonly property string normal_mesh_type: "" - readonly property string support_mesh_type: "support_mesh" - readonly property string cutting_mesh_type: "cutting_mesh" - readonly property string infill_mesh_type: "infill_mesh" - readonly property string anti_overhang_mesh_type: "anti_overhang_mesh" + readonly property string normalMeshType: "" + readonly property string supportMeshType: "support_mesh" + readonly property string cuttingMeshType: "cutting_mesh" + readonly property string infillMeshType: "infill_mesh" + readonly property string antiOverhangMeshType: "anti_overhang_mesh" property var currentMeshType: UM.ActiveTool.properties.getValue("MeshType") @@ -30,17 +30,16 @@ Item onCurrentMeshTypeChanged: { // set checked state of mesh type buttons - normalButton.checked = currentMeshType === normal_mesh_type - supportMeshButton.checked = currentMeshType === support_mesh_type - overhangMeshButton.checked = currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type - antiOverhangMeshButton.checked = currentMeshType === anti_overhang_mesh_type + normalButton.checked = type === normalMeshType + supportMeshButton.checked = type === supportMeshType + overhangMeshButton.checked = type === infillMeshType || type === cuttingMeshType + antiOverhangMeshButton.checked = type === antiOverhangMeshType // update active type label for (var button in meshTypeButtons.children) { - if (meshTypeButtons.children[button].checked) - { - meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text + if (meshTypeButtons.children[button].checked){ + meshTypeLabel.text = catalog.i18nc("@label", "Mesh Type") + ": " + meshTypeButtons.children[button].text break } } @@ -50,11 +49,11 @@ Item { if (infillOnlyCheckbox.checked) { - setMeshType(infill_mesh_type) + setMeshType(infillMeshType) } else { - setMeshType(cutting_mesh_type) + setMeshType(cuttingMeshType) } } @@ -63,6 +62,23 @@ Item UM.ActiveTool.setProperty("MeshType", type) } + function updateView(type) { + // set checked state of mesh type buttons + normalButton.checked = type === normal_mesh_type + supportMeshButton.checked = type === support_mesh_type + overhangMeshButton.checked = type === infill_mesh_type || type === cutting_mesh_type + antiOverhangMeshButton.checked = type === anti_overhang_mesh_type + + // update active type label + for (var button in meshTypeButtons.children) + { + if(meshTypeButtons.children[button].checked){ + meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text + break + } + } + } + UM.I18nCatalog { id: catalog; name: "uranium"} Column @@ -85,7 +101,7 @@ Item iconSource: UM.Theme.getIcon("pos_normal"); property bool needBorder: true checkable: true - onClicked: setMeshType(normal_mesh_type); + onClicked: setMeshType(normalMeshType); style: UM.Theme.styles.tool_button; z: 4 } @@ -97,7 +113,7 @@ Item iconSource: UM.Theme.getIcon("pos_print_as_support"); property bool needBorder: true checkable:true - onClicked: setMeshType(support_mesh_type) + onClicked: setMeshType(supportMeshType) style: UM.Theme.styles.tool_button; z: 3 } @@ -109,7 +125,7 @@ Item iconSource: UM.Theme.getIcon("pos_modify_overlaps"); property bool needBorder: true checkable:true - onClicked: setMeshType(infill_mesh_type) + onClicked: setMeshType(infillMeshType) style: UM.Theme.styles.tool_button; z: 2 } @@ -121,7 +137,7 @@ Item iconSource: UM.Theme.getIcon("pos_modify_dont_support_overlap"); property bool needBorder: true checkable: true - onClicked: setMeshType(anti_overhang_mesh_type) + onClicked: setMeshType(antiOverhangMeshType) style: UM.Theme.styles.tool_button; z: 1 } @@ -141,18 +157,18 @@ Item { id: infillOnlyCheckbox - text: catalog.i18nc("@action:checkbox","Infill only"); + text: catalog.i18nc("@action:checkbox", "Infill only"); style: UM.Theme.styles.checkbox; - visible: currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type + visible: currentMeshType === infillMeshType || currentMeshType === cuttingMeshType onClicked: setOverhangsMeshType() Binding { target: infillOnlyCheckbox property: "checked" - value: currentMeshType === infill_mesh_type + value: currentMeshType === infillMeshType } } @@ -193,9 +209,9 @@ Item { var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - if(currentMeshType == "support_mesh") + if (currentMeshType == "support_mesh") { - excluded_settings = excluded_settings.concat(base.all_categories_except_support) + excluded_settings = excluded_settings.concat(base.allCategoriesExceptSupport) } return excluded_settings } @@ -371,7 +387,7 @@ Item settingPickDialog.visible = true; if (currentMeshType == "support_mesh") { - settingPickDialog.additional_excluded_settings = base.all_categories_except_support; + settingPickDialog.additional_excluded_settings = base.allCategoriesExceptSupport; } else { @@ -394,7 +410,7 @@ Item onVisibilityChanged: { // force updating the model to sync it with addedSettingsModel - if(visible) + if (visible) { // Set skip setting, it will prevent from resetting selected mesh_type contents.model.visibilityHandler.addSkipResetSetting(currentMeshType) @@ -411,7 +427,7 @@ Item // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` // is set to "one_at_a_time", because the current backend architecture isn't ready for that. - if(filterInput.text != "") + if (filterInput.text != "") { new_filter["i18n_label"] = "*" + filterInput.text } From fbba39cb63bb1cf09f1ad86a30357c0e008945a3 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 18 Sep 2019 09:52:34 +0200 Subject: [PATCH 22/25] POS: Correct label text CURA-6683 --- 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 74fecf0cee..26cc1b7936 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -121,7 +121,7 @@ Item Button { id: overhangMeshButton - text: catalog.i18nc("@label", "Modify settings for overlays") + text: catalog.i18nc("@label", "Modify settings for overlaps") iconSource: UM.Theme.getIcon("pos_modify_overlaps"); property bool needBorder: true checkable:true From 7d66409494c813d29f18e8dcdeb3c9586495c7a2 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 18 Sep 2019 10:30:57 +0200 Subject: [PATCH 23/25] POS: Refactor settings dialog into its own file CURA-6683 --- .../PerObjectSettingsPanel.qml | 131 +---------------- .../SettingPickDialog.qml | 139 ++++++++++++++++++ 2 files changed, 140 insertions(+), 130 deletions(-) create mode 100644 plugins/PerObjectSettingsTool/SettingPickDialog.qml diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 26cc1b7936..a1e4d95298 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -398,138 +398,9 @@ Item } - UM.Dialog + SettingPickDialog { id: settingPickDialog - - title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") - width: screenScaleFactor * 360 - - property var additional_excluded_settings - - onVisibilityChanged: - { - // force updating the model to sync it with addedSettingsModel - if (visible) - { - // Set skip setting, it will prevent from resetting selected mesh_type - contents.model.visibilityHandler.addSkipResetSetting(currentMeshType) - listview.model.forceUpdate() - - updateFilter() - } - } - - function updateFilter() - { - var new_filter = {} - new_filter["settable_per_mesh"] = true - // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` - // is set to "one_at_a_time", because the current backend architecture isn't ready for that. - - if (filterInput.text != "") - { - new_filter["i18n_label"] = "*" + filterInput.text - } - - listview.model.filter = new_filter - } - - TextField - { - id: filterInput - - anchors - { - top: parent.top - left: parent.left - right: toggleShowAll.left - rightMargin: UM.Theme.getSize("default_margin").width - } - - placeholderText: catalog.i18nc("@label:textbox", "Filter...") - - onTextChanged: settingPickDialog.updateFilter() - } - - CheckBox - { - id: toggleShowAll - - anchors - { - top: parent.top - right: parent.right - } - - text: catalog.i18nc("@label:checkbox", "Show all") - checked: listview.model.showAll - onClicked: - { - listview.model.showAll = checked - } - } - - ScrollView - { - id: scrollView - - anchors - { - top: filterInput.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - ListView - { - id:listview - model: UM.SettingDefinitionsModel - { - id: definitionsModel - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - visibilityHandler: UM.SettingPreferenceVisibilityHandler {} - expanded: [ "*" ] - exclude: - { - var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) - return excluded_settings - } - } - delegate:Loader - { - id: loader - - width: parent.width - height: model.type != undefined ? UM.Theme.getSize("section").height : 0 - - property var definition: model - property var settingDefinitionsModel: definitionsModel - - asynchronous: true - source: - { - switch(model.type) - { - case "category": - return "PerObjectCategory.qml" - default: - return "PerObjectItem.qml" - } - } - } - Component.onCompleted: settingPickDialog.updateFilter() - } - } - - rightButtons: [ - Button - { - text: catalog.i18nc("@action:button", "Close") - onClicked: settingPickDialog.visible = false - } - ] } UM.SettingPropertyProvider diff --git a/plugins/PerObjectSettingsTool/SettingPickDialog.qml b/plugins/PerObjectSettingsTool/SettingPickDialog.qml new file mode 100644 index 0000000000..92e22f26bc --- /dev/null +++ b/plugins/PerObjectSettingsTool/SettingPickDialog.qml @@ -0,0 +1,139 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +import UM 1.2 as UM +import Cura 1.0 as Cura +import ".." + +UM.Dialog + { + id: settingPickDialog + + title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") + width: screenScaleFactor * 360 + + property var additional_excluded_settings + + onVisibilityChanged: + { + // force updating the model to sync it with addedSettingsModel + if (visible) + { + // Set skip setting, it will prevent from resetting selected mesh_type + contents.model.visibilityHandler.addSkipResetSetting(currentMeshType) + listview.model.forceUpdate() + + updateFilter() + } + } + + function updateFilter() + { + var new_filter = {} + new_filter["settable_per_mesh"] = true + // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` + // is set to "one_at_a_time", because the current backend architecture isn't ready for that. + + if (filterInput.text != "") + { + new_filter["i18n_label"] = "*" + filterInput.text + } + + listview.model.filter = new_filter + } + + TextField { + id: filterInput + + anchors { + top: parent.top + left: parent.left + right: toggleShowAll.left + rightMargin: UM.Theme.getSize("default_margin").width + } + + placeholderText: catalog.i18nc("@label:textbox", "Filter...") + + onTextChanged: settingPickDialog.updateFilter() + } + + CheckBox + { + id: toggleShowAll + + anchors { + top: parent.top + right: parent.right + } + + text: catalog.i18nc("@label:checkbox", "Show all") + checked: listview.model.showAll + onClicked: + { + listview.model.showAll = checked + } + } + + ScrollView + { + id: scrollView + + anchors + { + top: filterInput.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + ListView + { + id:listview + model: UM.SettingDefinitionsModel + { + id: definitionsModel + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + visibilityHandler: UM.SettingPreferenceVisibilityHandler {} + expanded: [ "*" ] + exclude: + { + var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] + excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) + return excluded_settings + } + } + delegate:Loader + { + id: loader + + width: parent.width + height: model.type != undefined ? UM.Theme.getSize("section").height : 0 + + property var definition: model + property var settingDefinitionsModel: definitionsModel + + asynchronous: true + source: + { + switch(model.type) + { + case "category": + return "PerObjectCategory.qml" + default: + return "PerObjectItem.qml" + } + } + } + Component.onCompleted: settingPickDialog.updateFilter() + } + } + + rightButtons: [ + Button { + text: catalog.i18nc("@action:button", "Close") + onClicked: { + settingPickDialog.visible = false + } + } + ] + } \ No newline at end of file From 9fa2b268977d9a5a622407ac909bd0d8f02b1519 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 18 Sep 2019 11:06:17 +0200 Subject: [PATCH 24/25] Styling: do not use thick_lining for selected tool icons. Affects Per Object Settings and rotate Lay Flat CURA-6683 --- resources/themes/cura-light/styles.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index f2361a8604..daf06ac6af 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -240,7 +240,7 @@ QtObject } Behavior on color { ColorAnimation { duration: 50; } } - border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? (control.checked ? Theme.getSize("thick_lining").width : Theme.getSize("default_lining").width) : 0 + border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? Theme.getSize("default_lining").width : 0 border.color: control.checked ? Theme.getColor("icon") : Theme.getColor("lining") } } From 53ea6ce1a788930e630cca3fd6e1a880b7a6e167 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 18 Sep 2019 11:39:58 +0200 Subject: [PATCH 25/25] POS: Fix: currentMeshType reference CURA-6683 --- .../PerObjectSettingsPanel.qml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index a1e4d95298..bb342d5045 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -29,6 +29,8 @@ Item // Update the view every time the currentMeshType changes onCurrentMeshTypeChanged: { + var type = currentMeshType + // set checked state of mesh type buttons normalButton.checked = type === normalMeshType supportMeshButton.checked = type === supportMeshType @@ -62,23 +64,6 @@ Item UM.ActiveTool.setProperty("MeshType", type) } - function updateView(type) { - // set checked state of mesh type buttons - normalButton.checked = type === normal_mesh_type - supportMeshButton.checked = type === support_mesh_type - overhangMeshButton.checked = type === infill_mesh_type || type === cutting_mesh_type - antiOverhangMeshButton.checked = type === anti_overhang_mesh_type - - // update active type label - for (var button in meshTypeButtons.children) - { - if(meshTypeButtons.children[button].checked){ - meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text - break - } - } - } - UM.I18nCatalog { id: catalog; name: "uranium"} Column