From 9f52a52ea3ee9e497c8b7dc220a9077ad7c64c59 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 18 Dec 2018 09:32:11 +0100 Subject: [PATCH 1/6] Fix ExtruderModel reference in machine settings dialog --- .../MachineSettingsAction.qml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index d8efe6f8b8..a9900070a8 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -14,20 +14,9 @@ Cura.MachineAction { id: base property var extrudersModel: CuraApplication.getExtrudersModel() - property int extruderTabsCount: 0 property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : "" - Connections - { - target: base.extrudersModel - onModelChanged: - { - var extruderCount = base.extrudersModel.count; - base.extruderTabsCount = extruderCount; - } - } - Connections { target: dialog ? dialog : null @@ -357,11 +346,11 @@ Cura.MachineAction Repeater { id: extruderTabsRepeater - model: base.extruderTabsCount + model: base.extrudersModel Tab { - title: base.extrudersModel.getItem(index).name + title: model.name anchors.margins: UM.Theme.getSize("default_margin").width Column From 1ac5403c21a6b55f372f19329328ef618ecf03fb Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 18 Dec 2018 15:52:26 +0100 Subject: [PATCH 2/6] Remove extruder tabs from tabView CURA-6036 --- .../MachineSettingsAction/MachineSettingsAction.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index a9900070a8..60dd31dcae 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -348,6 +348,17 @@ Cura.MachineAction id: extruderTabsRepeater model: base.extrudersModel + + onItemAdded: + { + settingsTabs.addTab(index + 1, item) + } + + onItemRemoved: + { + settingsTabs.removeTab(index + 1) + } + Tab { title: model.name From 7cf1df74354022c5cceba84ae8ab304ad0d16b1e Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 18 Dec 2018 16:19:21 +0100 Subject: [PATCH 3/6] Remove back Cura.ExtrudersModel{}, because if retrieve the model from backend the tabs cannot be removed after model update. The QML bug CURA-6036 --- .../MachineSettingsAction.qml | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 60dd31dcae..ef8fda224a 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -13,10 +13,22 @@ import Cura 1.0 as Cura Cura.MachineAction { id: base - property var extrudersModel: CuraApplication.getExtrudersModel() + property var extrudersModel: Cura.ExtrudersModel{} // Do not retrieve the Model from a backend. Otherwise the tabs + // in tabView will not removed/updated. Probably QML bug + property int extruderTabsCount: 0 property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : "" + Connections + { + target: base.extrudersModel + onModelChanged: + { + var extruderCount = base.extrudersModel.count; + base.extruderTabsCount = extruderCount; + } + } + Connections { target: dialog ? dialog : null @@ -346,22 +358,11 @@ Cura.MachineAction Repeater { id: extruderTabsRepeater - model: base.extrudersModel - - - onItemAdded: - { - settingsTabs.addTab(index + 1, item) - } - - onItemRemoved: - { - settingsTabs.removeTab(index + 1) - } + model: base.extruderTabsCount Tab { - title: model.name + title: base.extrudersModel.getItem(index).name anchors.margins: UM.Theme.getSize("default_margin").width Column From 6987d5ff782c53253c1b85b9f280ee4b9b328b59 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 19 Dec 2018 09:33:46 +0100 Subject: [PATCH 4/6] Add a radius to the printer type label --- resources/qml/PrinterTypeLabel.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrinterTypeLabel.qml b/resources/qml/PrinterTypeLabel.qml index 7feae32e16..cfc9e56513 100644 --- a/resources/qml/PrinterTypeLabel.qml +++ b/resources/qml/PrinterTypeLabel.qml @@ -19,6 +19,7 @@ Item { anchors.fill: parent color: UM.Theme.getColor("printer_type_label_background") + radius: UM.Theme.getSize("checkbox_radius").width } Label From f1c28498a67aa73f93ada591bfdcb01c7ec14e59 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 11:00:00 +0100 Subject: [PATCH 5/6] Display 0 if there are no measurements for minimum values Don't display max float then. --- plugins/SimulationView/SimulationView.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 6a0ffc1666..ae01b7cdb0 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -342,12 +342,16 @@ class SimulationView(CuraView): return self._extruder_count def getMinFeedrate(self) -> float: + if abs(self._min_feedrate - sys.float_info.max) < 10: # Some lenience due to floating point rounding. + return 0.0 # If it's still max-float, there are no measurements. Use 0 then. return self._min_feedrate def getMaxFeedrate(self) -> float: return self._max_feedrate def getMinThickness(self) -> float: + if abs(self._min_thickness - sys.float_info.max) < 10: # Some lenience due to floating point rounding. + return 0.0 # If it's still max-float, there are no measurements. Use 0 then. return self._min_thickness def getMaxThickness(self) -> float: From 56d0a52faccb3cc0cd5ecd8701b342a530395ed3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 19 Dec 2018 11:51:46 +0100 Subject: [PATCH 6/6] Documentation and code style --- plugins/SimulationView/SimulationViewMenuComponent.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index eec254c0dd..fe32fe9eb1 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -358,7 +358,7 @@ Cura.ExpandableComponent width: parent.width height: UM.Theme.getSize("layerview_row").height - Label + Label //Minimum value. { text: { @@ -383,9 +383,10 @@ Cura.ExpandableComponent renderType: Text.NativeRendering } - Label + Label //Unit in the middle. { - text: { + text: + { if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) { // Feedrate selected @@ -407,7 +408,7 @@ Cura.ExpandableComponent font: UM.Theme.getFont("default") } - Label + Label //Maximum value. { text: { if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)