From aed5e631dce49fdad71afc80775dc8533a28d6d4 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 13:13:55 +0200 Subject: [PATCH 1/8] 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/8] 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 a337fd4e9c90164456cbd0e366af4f8d055a0a8e Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 14:32:05 +0200 Subject: [PATCH 3/8] CURA-4380 quality slider text disabled color when slider cannot be used --- resources/qml/SidebarSimple.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index c2664c37a3..c690494d46 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -309,7 +309,7 @@ Item text: catalog.i18nc("@label", "Slower") font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") horizontalAlignment: Text.AlignLeft } @@ -320,7 +320,7 @@ Item text: catalog.i18nc("@label", "Faster") font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") horizontalAlignment: Text.AlignRight } } From a8ce7185cc027b7ab9b5048c74554273717d1f96 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 14:35:13 +0200 Subject: [PATCH 4/8] CURA-4380 gradual infill checkbox closer to slider to indicate category --- 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 c690494d46..221efa5904 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -505,7 +505,7 @@ Item property alias _hovered: enableGradualInfillMouseArea.containsMouse anchors.top: infillSlider.bottom - anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2 // closer to slider since it belongs to the same category anchors.left: infillCellRight.left style: UM.Theme.styles.checkbox From c1cfb76f8a0ff65ad1bb8cac1444aeb40f6151d4 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 27 Sep 2017 14:51:20 +0200 Subject: [PATCH 5/8] CURA-4380 code improvements for build plate adhesion label --- resources/qml/SidebarSimple.qml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 221efa5904..7a4cfbf68f 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -726,15 +726,19 @@ Item { id: adhesionHelperLabel visible: adhesionCheckBox.visible - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width - anchors.right: infillCellLeft.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width - anchors.verticalCenter: adhesionCheckBox.verticalCenter - text: catalog.i18nc("@label", "Build Plate Adhesion"); - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); + + text: catalog.i18nc("@label", "Build Plate Adhesion") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") elide: Text.ElideRight + + anchors { + left: parent.left + leftMargin: UM.Theme.getSize("sidebar_margin").width + right: infillCellLeft.right + rightMargin: UM.Theme.getSize("sidebar_margin").width + verticalCenter: adhesionCheckBox.verticalCenter + } } CheckBox From 4b3e83f876c29ec286f974e6b0fdf1c5dccf4ca9 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 27 Sep 2017 15:55:34 +0200 Subject: [PATCH 6/8] 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 7/8] 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 8/8] 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 {