From aed5e631dce49fdad71afc80775dc8533a28d6d4 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 13:13:55 +0200 Subject: [PATCH 1/5] CURA-4352 fix passing int values as float when changing slider value --- resources/qml/SidebarSimple.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index d93dd67550..b94c1ced4e 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -354,8 +354,6 @@ Item } } - - Item { id: infillCellRight @@ -405,7 +403,7 @@ Item value: parseInt(infillDensity.properties.value) onValueChanged: { - infillDensity.setPropertyValue("value", infillSlider.value) + infillDensity.setPropertyValue("value", String(parseInt(infillSlider.value))) } style: SliderStyle @@ -829,7 +827,6 @@ Item UM.SettingPropertyProvider { id: infillExtruderNumber - containerStackId: Cura.MachineManager.activeStackId key: "infill_extruder_nr" watchedProperties: [ "value" ] From f8e8dcacdf931b12bdddd1093edb2e1d1245f60c Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 13:55:57 +0200 Subject: [PATCH 2/5] CURA-4381 use modulus to set infill slider step size and tick show --- resources/qml/SidebarSimple.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index b94c1ced4e..6d67b927bd 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -393,7 +393,7 @@ Item minimumValue: 0 maximumValue: 100 - stepSize: 10 + stepSize: (parseInt(infillDensity.properties.value) % 10 == 0) ? 10 : 1 tickmarksEnabled: true // disable slider when gradual support is enabled @@ -403,12 +403,12 @@ Item value: parseInt(infillDensity.properties.value) onValueChanged: { + // Explicitly cast to string to make sure the value passed to Python is an integer. infillDensity.setPropertyValue("value", String(parseInt(infillSlider.value))) } style: SliderStyle { - groove: Rectangle { id: groove implicitWidth: 200 @@ -431,6 +431,18 @@ Item tickmarks: Repeater { id: repeater model: control.maximumValue / control.stepSize + 1 + + // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) + function shouldShowTick (index) { + if ((parseInt(infillDensity.properties.value) % 10 == 0)) { + return true + } else if (index % 10 == 0) { + return true + } else { + return false + } + } + Rectangle { anchors.verticalCenter: parent.verticalCenter color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") @@ -438,6 +450,7 @@ Item height: 6 y: 0 x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1)) + visible: shouldShowTick(index) } } } From 4b3e83f876c29ec286f974e6b0fdf1c5dccf4ca9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 27 Sep 2017 15:55:34 +0200 Subject: [PATCH 3/5] Not allowing to modify the number of extruders in multiextruder printers, except Custom FDM printers - CURA-4359 --- plugins/MachineSettingsAction/MachineSettingsAction.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.py b/plugins/MachineSettingsAction/MachineSettingsAction.py index 832e247d19..3672066678 100755 --- a/plugins/MachineSettingsAction/MachineSettingsAction.py +++ b/plugins/MachineSettingsAction/MachineSettingsAction.py @@ -112,7 +112,13 @@ class MachineSettingsAction(MachineAction): if not self._global_container_stack: return 0 - return len(self._global_container_stack.getMetaDataEntry("machine_extruder_trains")) + # If there is a printer that originally is multi-extruder, it's not allowed to change the number of extruders + # It's just allowed in case of Custom FDM printers + definition_container = self._global_container_stack.getBottom() + if definition_container.getId() == "custom": + return len(self._global_container_stack.getMetaDataEntry("machine_extruder_trains")) + return 0 + @pyqtSlot(int) def setMachineExtruderCount(self, extruder_count): From 3ddb45160d47d5c458619c6f5113f0e40b13fa05 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 16:59:03 +0200 Subject: [PATCH 4/5] Update infill slider icon border color to not look like a checkbox, fixes #2487 --- resources/qml/SidebarSimple.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 8baba3f282..0509697530 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -485,7 +485,7 @@ Item visible: infillIconList.activeIndex == index border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("quality_slider_available") + border.color: UM.Theme.getColor("quality_slider_unavailable") UM.RecolorImage { anchors.fill: parent From f8722a2d4b9dfe3330091ac381a1e131fd2c0c16 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 27 Sep 2017 17:21:43 +0200 Subject: [PATCH 5/5] Fixed code style in the function - CURA-4352 --- resources/qml/SidebarSimple.qml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index ef2f7c484c..ef1512e6af 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -434,13 +434,10 @@ Item // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size) function shouldShowTick (index) { - if ((parseInt(infillDensity.properties.value) % 10 == 0)) { + if ((parseInt(infillDensity.properties.value) % 10 == 0) || (index % 10 == 0)) { return true - } else if (index % 10 == 0) { - return true - } else { - return false } + return false } Rectangle {