From ab50ac0d89df8bd3201a3a779dd4b13e91a95c69 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Sep 2016 13:59:00 +0200 Subject: [PATCH 1/7] Don't show possibly incorrect materials in print monitor --- cura/Settings/ExtrudersModel.py | 18 +++++++++++++++++- resources/qml/PrintMonitor.qml | 6 +++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 26c05d3787..0ba6cdcfd6 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -46,6 +46,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): self.addRoleName(self.IndexRole, "index") self._add_global = False + self._simple_names = False self._active_extruder_stack = None @@ -70,6 +71,21 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): def addGlobal(self): return self._add_global + ## Set the simpleNames property. + def setSimpleNames(self, simple_names): + if simple_names != self._simple_names: + self._simple_names = simple_names + self.simpleNamesChanged.emit() + self._updateExtruders() + + ## Emitted when the simpleNames property changes. + simpleNamesChanged = pyqtSignal() + + ## Whether or not the model should show all definitions regardless of visibility. + @pyqtProperty(bool, fset = setSimpleNames, notify = simpleNamesChanged) + def simpleNames(self): + return self._simple_names + def _onActiveExtruderChanged(self): manager = ExtruderManager.getInstance() active_extruder_stack = manager.getActiveExtruderStack() @@ -119,7 +135,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): for extruder in manager.getMachineExtruders(global_container_stack.getId()): extruder_name = extruder.getName() material = extruder.findContainer({ "type": "material" }) - if material: + if material and not self._simple_names: extruder_name = "%s (%s)" % (material.getName(), extruder_name) position = extruder.getMetaDataEntry("position", default = "0") # Get the position try: diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 27b0e532d4..8d04122aa8 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -14,7 +14,11 @@ Column id: printMonitor property var connectedPrinter: printerConnected ? Cura.MachineManager.printerOutputDevices[0] : null - Cura.ExtrudersModel { id: extrudersModel } + Cura.ExtrudersModel + { + id: extrudersModel + simpleNames: true + } Label { From 549766e5f65a56f2c27952b9a1d29ff6c86a736a Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Sep 2016 14:15:34 +0200 Subject: [PATCH 2/7] Fix layout of buttons on profile page CURA-2368 --- resources/qml/Preferences/ProfilesPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 65f6626378..87597ae205 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -167,11 +167,11 @@ UM.ManagementPage elide: Text.ElideRight } - Row { + Flow { id: currentSettingsActions visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId - anchors.left: parent.left + anchors.right: parent.right anchors.top: profileName.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height From a47ffb22889c027d8949073a6ba076bcf2a8237b Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Sep 2016 14:57:26 +0200 Subject: [PATCH 3/7] Remove commented out code --- resources/qml/Preferences/ProfilesPage.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 87597ae205..94e452444e 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -14,7 +14,6 @@ UM.ManagementPage title: catalog.i18nc("@title:tab", "Profiles"); property var extrudersModel: Cura.ExtrudersModel{} - //Cura.ExtrudersModel { id: extrudersModel} model: UM.InstanceContainersModel { From 151fcfdda6e52b38d6d3ee9f1624b0a383a5cef3 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Sep 2016 15:15:54 +0200 Subject: [PATCH 4/7] Update method order for readability --- cura/Settings/MachineManager.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index f2967c7797..5a91bc1706 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -124,22 +124,6 @@ class MachineManager(QObject): else: Logger.log("w", "No variant found for printer definition %s with id %s" % (self._global_container_stack.getBottom().getId(), hotend_id)) - def _autoUpdateHotends(self): - extruder_manager = ExtruderManager.getInstance() - for position in self._auto_hotends_changed: - hotend_id = self._auto_hotends_changed[position] - old_index = extruder_manager.activeExtruderIndex - - if old_index != int(position): - extruder_manager.setActiveExtruderIndex(int(position)) - else: - old_index = None - Logger.log("d", "Setting hotend variant of hotend %s to %s" % (position, hotend_id)) - self.setActiveVariant(hotend_id) - - if old_index is not None: - extruder_manager.setActiveExtruderIndex(old_index) - def _onMaterialIdChanged(self, index, material_id): if not self._global_container_stack: return @@ -189,6 +173,22 @@ class MachineManager(QObject): if old_index is not None: extruder_manager.setActiveExtruderIndex(old_index) + def _autoUpdateHotends(self): + extruder_manager = ExtruderManager.getInstance() + for position in self._auto_hotends_changed: + hotend_id = self._auto_hotends_changed[position] + old_index = extruder_manager.activeExtruderIndex + + if old_index != int(position): + extruder_manager.setActiveExtruderIndex(int(position)) + else: + old_index = None + Logger.log("d", "Setting hotend variant of hotend %s to %s" % (position, hotend_id)) + self.setActiveVariant(hotend_id) + + if old_index is not None: + extruder_manager.setActiveExtruderIndex(old_index) + def _onGlobalContainerChanged(self): if self._global_container_stack: self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged) From 5c49adc52e26584c09b850f2ef649093e5a9b628 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 14 Sep 2016 15:37:12 +0200 Subject: [PATCH 5/7] Also return tuple if upgrading failed It is checked if the file data is None or empty (the upgrade is then considered 'failed'). But to unpack the file data, it needs to be a tuple. Contributes to issue CURA-844. --- plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index ff404c0398..a09ac4f3d7 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -80,7 +80,7 @@ class Profile: import VersionUpgrade21to22 # Import here to prevent circular dependencies. if self._name == "Current settings": - return None #Can't upgrade these, because the new current profile needs to specify the definition ID and the old file only had the machine instance, not the definition. + return None, None #Can't upgrade these, because the new current profile needs to specify the definition ID and the old file only had the machine instance, not the definition. config = configparser.ConfigParser(interpolation = None) From 5c5d1888894d541eb8ff8c092daf5bf1170ff7fd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 14 Sep 2016 15:41:22 +0200 Subject: [PATCH 6/7] Remove support_area_smoothing setting Contributes to issue CURA-2296. --- .../VersionUpgrade21to22/VersionUpgrade21to22.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py b/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py index 0b021467c4..286667f5b0 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py @@ -118,6 +118,12 @@ _profile_translations = { "tpu_0.6_fast": "um2p_tpu_0.6_fast" } +## Settings that are no longer in the new version. +_removed_settings = { + "fill_perimeter_gaps", + "support_area_smoothing" +} + ## How to translate setting names from the old version to the new. _setting_name_translations = { "remove_overlapping_walls_0_enabled": "travel_compensate_overlapping_walls_0_enabled", @@ -385,7 +391,7 @@ class VersionUpgrade21to22(VersionUpgrade): @staticmethod def translateSettings(settings): for key, value in settings.items(): - if key == "fill_perimeter_gaps": #Setting is removed. + if key in _removed_settings: del settings[key] elif key == "retraction_combing": #Combing was made into an enum instead of a boolean. settings[key] = "off" if (value == "False") else "all" From cf7a6730d134a23d4715a7838806789341c90df2 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Sep 2016 17:39:49 +0200 Subject: [PATCH 7/7] Add a menuitem to load the nozzle/material loaded on the printer CURA-2276 --- resources/qml/Cura.qml | 4 ++-- resources/qml/Menus/MaterialMenu.qml | 25 +++++++++++++++++++++++-- resources/qml/Menus/NozzleMenu.qml | 21 +++++++++++++++++++-- resources/qml/SidebarHeader.qml | 4 ++-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a3dda4d7c2..eba803ef28 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -145,8 +145,8 @@ UM.MainWindow title: model.name visible: machineExtruderCount.properties.value > 1 - NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants } - MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials } + NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } + MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials; extruderIndex: index } ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); } MenuSeparator { } diff --git a/resources/qml/Menus/MaterialMenu.qml b/resources/qml/Menus/MaterialMenu.qml index 03c951debd..d2e6bc03ce 100644 --- a/resources/qml/Menus/MaterialMenu.qml +++ b/resources/qml/Menus/MaterialMenu.qml @@ -12,11 +12,32 @@ Menu id: menu title: "Material" + property int extruderIndex: 0 + property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 + MenuItem { id: automaticMaterial - text: catalog.i18nc("@title:menuitem %1 is the value from the printer", "Automatic: %1").arg("[material_name]") - visible: false + text: + { + var materialName = Cura.MachineManager.printerOutputDevices[0].materialNames[extruderIndex]; + return catalog.i18nc("@title:menuitem %1 is the value from the printer", "Automatic: %1").arg(materialName); + } + visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex + onTriggered: + { + var material_id = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex]; + var items = materialsModel.items; + // materialsModel.find cannot be used because we need to look inside the metadata property of items + for(var i in items) + { + if (items[i]["metadata"]["GUID"] == material_id) + { + Cura.MachineManager.setActiveMaterial(items[i].id); + break; + } + } + } } MenuSeparator diff --git a/resources/qml/Menus/NozzleMenu.qml b/resources/qml/Menus/NozzleMenu.qml index fa83c22af1..7f1c652c4a 100644 --- a/resources/qml/Menus/NozzleMenu.qml +++ b/resources/qml/Menus/NozzleMenu.qml @@ -12,11 +12,27 @@ Menu id: menu title: "Nozzle" + property int extruderIndex: 0 + property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 + MenuItem { id: automaticNozzle - text: catalog.i18nc("@title:menuitem %1 is the value from the printer", "Automatic: %1").arg("[nozzle_name]") - visible: false + text: + { + var nozzleName = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex]; + return catalog.i18nc("@title:menuitem %1 is the value from the printer", "Automatic: %1").arg(nozzleName); + } + visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex + onTriggered: + { + var hotendId = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex]; + var itemIndex = nozzleInstantiator.model.find("name", hotendId); + if(itemIndex > -1) + { + Cura.MachineManager.setActiveVariant(nozzleInstantiator.model.getItem(itemIndex).id) + } + } } MenuSeparator @@ -26,6 +42,7 @@ Menu Instantiator { + id: nozzleInstantiator model: UM.InstanceContainersModel { filter: diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 47c0fea9e3..9ed30477d8 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -223,7 +223,7 @@ Column anchors.left: parent.left style: UM.Theme.styles.sidebar_header_button - menu: NozzleMenu { } + menu: NozzleMenu { extruderIndex: base.currentExtruderIndex } } ToolButton { @@ -251,7 +251,7 @@ Column anchors.right: parent.right style: UM.Theme.styles.sidebar_header_button - menu: MaterialMenu { } + menu: MaterialMenu { extruderIndex: base.currentExtruderIndex } } } }