From 7dbafa06d1ae2b53e77726dee45662d721470ccb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Jun 2016 16:00:52 +0200 Subject: [PATCH 1/2] Make SidebarHeader use ExtrudersModel This model is also used by the extruder selection drop-downs, and it's automatically filled already so that was double logic. Contributes to issues CURA-340 and CURA-1278. --- resources/qml/SidebarHeader.qml | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 237746ac0d..75f5393d57 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -104,7 +104,7 @@ Item anchors.leftMargin: model.index * (extruderSelection.width / machineExtruderCount.properties.value) anchors.verticalCenter: parent.verticalCenter width: parent.width / machineExtruderCount.properties.value - text: model.text + text: model.name exclusiveGroup: extruderMenuGroup; checkable: true; checked: base.currentExtruderIndex == index @@ -138,10 +138,11 @@ Item } } ExclusiveGroup { id: extruderMenuGroup; } - ListView{ + ListView + { id: extrudersList property var index: 0 - model: extrudersListModel + model: Cura.ExtrudersModel {} delegate: wizardDelegate anchors.top: parent.top anchors.left: parent.left @@ -149,28 +150,6 @@ Item } } - ListModel - { - id: extrudersListModel - Component.onCompleted: populateExtruderModel() - } - Connections - { - id: machineChange - target: Cura.MachineManager - onGlobalContainerChanged: populateExtruderModel() - } - - function populateExtruderModel() - { - extrudersListModel.clear(); - for(var extruder = 0; extruder < machineExtruderCount.properties.value ; extruder++) { - extrudersListModel.append({ - text: catalog.i18nc("@label", "Extruder %1").arg(extruder + 1) - }) - } - } - Rectangle { id: variantRow anchors.top: extruderSelection.visible ? extruderSelection.bottom : machineSelectionRow.bottom From 4d418a7c1a94ddfe11a3f3e6b252821b9e077d73 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Jun 2016 16:26:57 +0200 Subject: [PATCH 2/2] When switching active extruder, get the extruder train from definition id Not from extruder container stack ID. Contributes to issues CURA-340 and CURA-1278. --- cura/ExtruderManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/ExtruderManager.py b/cura/ExtruderManager.py index b4d05d7e6c..c8a07a4000 100644 --- a/cura/ExtruderManager.py +++ b/cura/ExtruderManager.py @@ -36,7 +36,7 @@ class ExtruderManager(QObject): if not UM.Application.getInstance().getGlobalContainerStack(): return None #No active machine, so no active extruder. try: - return self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][str(self._active_extruder_index)] + return self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getBottom().getId()][str(self._active_extruder_index)] except KeyError: #Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong. return None