From ead91db06291dcfa08c2b9ece9275d0a65ba1b95 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 5 Jun 2016 13:54:55 +0200 Subject: [PATCH 01/12] Fix activating another container stack when the currently active stack is removed CURA-1632 --- cura/MachineManagerModel.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cura/MachineManagerModel.py b/cura/MachineManagerModel.py index 50098dfa1b..a0af119636 100644 --- a/cura/MachineManagerModel.py +++ b/cura/MachineManagerModel.py @@ -405,11 +405,13 @@ class MachineManagerModel(QObject): @pyqtSlot(str) def removeMachine(self, machine_id): # If the machine that is being removed is the currently active machine, set another machine as the active machine - if self._global_container_stack and self._global_container_stack.getId() == machine_id: - containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks() - if containers: - Application.getInstance().setGlobalContainerStack(containers[0]) + activate_new_machine = (self._global_container_stack and self._global_container_stack.getId() == machine_id) UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id) + if activate_new_machine: + stacks = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(type = "machine") + if stacks: + Application.getInstance().setGlobalContainerStack(stacks[0]) + @pyqtProperty(bool, notify = globalContainerChanged) def hasMaterials(self): From c21475abd78a103bfc394e098cd92194a461dd8a Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 5 Jun 2016 14:05:56 +0200 Subject: [PATCH 02/12] Prevent multiple machines having the same custom name Caused by container vs containerstack confusion Fixes CURA-1606 and CURA-1649 --- cura/MachineManagerModel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/MachineManagerModel.py b/cura/MachineManagerModel.py index a0af119636..75b273e1f5 100644 --- a/cura/MachineManagerModel.py +++ b/cura/MachineManagerModel.py @@ -179,8 +179,8 @@ class MachineManagerModel(QObject): i = 1 # Check both the id and the name, because they may not be the same and it is better if they are both unique - while UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = unique_name) or \ - UM.Settings.ContainerRegistry.getInstance().findContainers(None, name = unique_name): + while UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = unique_name, type = "machine") or \ + UM.Settings.ContainerRegistry.getInstance().findContainerStacks(name = unique_name, type = "machine"): i += 1 unique_name = "%s #%d" % (name, i) From 9aa8ca329221f8e8b8b0ec78830eaa34dc97d287 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 5 Jun 2016 16:03:31 +0200 Subject: [PATCH 03/12] Fix uninitialised variable CURA-1619 --- cura/PrintInformation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 47d3989b55..f1eb93de0e 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -51,6 +51,8 @@ class PrintInformation(QObject): self._backend.printDurationMessage.connect(self._onPrintDurationMessage) self._job_name = "" + self._abbr_machine = "" + Application.getInstance().globalContainerStackChanged.connect(self._setAbbreviatedMachineName) Application.getInstance().fileLoaded.connect(self.setJobName) From d810c7ddbb9d9594ec622b2be9ac372cba4225dc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Jun 2016 17:00:38 +0200 Subject: [PATCH 04/12] Properly reload extruders at the start The extruder manager was too late to catch the initial global stack switch and machine switch. Now it just always reloads the extruders at the beginning. Contributes to issues CURA-1278 and CURA-351. --- cura/ExtruderManager.py | 4 +++- cura/ExtrudersModel.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/ExtruderManager.py b/cura/ExtruderManager.py index bfce380a70..46cdeabc91 100644 --- a/cura/ExtruderManager.py +++ b/cura/ExtruderManager.py @@ -27,6 +27,7 @@ class ExtruderManager: self._next_item = 0 #For when you use this class as iterator. UM.Application.getInstance().globalContainerStackChanged.connect(self._reconnectExtruderReload) #When the current machine changes, we need to reload all extruders belonging to the new machine. + self._reconnectExtruderReload() ## Gets an instance of this extruder manager. # @@ -51,6 +52,7 @@ class ExtruderManager: self._global_container_stack.containersChanged.disconnect(self._reloadExtruders) #Disconnect from the old global container stack. self._global_container_stack = UM.Application.getInstance().getGlobalContainerStack() self._global_container_stack.containersChanged.connect(self._reloadExtruders) #When the current machine changes, we need to reload all extruders belonging to the new machine. + self._reloadExtruders() ## (Re)loads all extruders of the currently active machine. # @@ -66,7 +68,7 @@ class ExtruderManager: #Get the extruder definitions belonging to the current machine. machine = self._global_container_stack.getBottom() extruder_train_ids = machine.getMetaDataEntry("machine_extruder_trains") - for extruder_train_id in extruder_train_ids: + for _,extruder_train_id in extruder_train_ids.items(): extruder_definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = extruder_train_id) #Should be only 1 definition if IDs are unique, but add the whole list anyway. if not extruder_definitions: #Empty list or error. UM.Logger.log("w", "Machine definition %s refers to an extruder train \"%s\", but no such extruder was found.", machine.getId(), extruder_train_id) diff --git a/cura/ExtrudersModel.py b/cura/ExtrudersModel.py index eb63bc4257..60514e8708 100644 --- a/cura/ExtrudersModel.py +++ b/cura/ExtrudersModel.py @@ -53,4 +53,5 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): "index": index } self.appendItem(item) + print("Appending extruder " + extruder.name + " to presenter.") self.sort(lambda item: item["index"]) \ No newline at end of file From 9b2acf03174410b09bc6f0e35c3975a5cf507723 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Jun 2016 17:12:22 +0200 Subject: [PATCH 05/12] Remove print statement Contributes to issues CURA-1278 and CURA-351. --- cura/ExtrudersModel.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/ExtrudersModel.py b/cura/ExtrudersModel.py index 60514e8708..eb63bc4257 100644 --- a/cura/ExtrudersModel.py +++ b/cura/ExtrudersModel.py @@ -53,5 +53,4 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): "index": index } self.appendItem(item) - print("Appending extruder " + extruder.name + " to presenter.") self.sort(lambda item: item["index"]) \ No newline at end of file From b4782e9b122ff4b5eaff134d2e4c7cef25540abb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Jun 2016 17:13:30 +0200 Subject: [PATCH 06/12] Pass definition to _uniqueName instead of name This function expects the entire definition. Contributes to issueS CURA-1278 and CURA-351. --- cura/Extruder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Extruder.py b/cura/Extruder.py index 4bbe24183d..f27cd061bd 100644 --- a/cura/Extruder.py +++ b/cura/Extruder.py @@ -25,7 +25,7 @@ class Extruder: self._nozzles += container_registry.findInstanceContainers(type = "nozzle", definitions = self._definition.getId()) #Create a container stack for this extruder. - self._name = self._uniqueName(self._definition.getId()) + self._name = self._uniqueName(self._definition) self._container_stack = UM.Settings.ContainerStack(self._name) self._container_stack.addMetaDataEntry("type", "extruder_train") self._container_stack.addContainer(self._definition) From c50d0a97dab3b23042bdd90da889450864f1556e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Jun 2016 17:18:09 +0200 Subject: [PATCH 07/12] Load extruder combobox synchronously Asynchronously causes Qt 5.4 to give a segfault. Contributes to issues CURA-351 and CURA-1278. --- plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml | 2 +- resources/qml/Settings/SettingView.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index d707fe9810..8ab05e90c1 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -56,7 +56,7 @@ Item { //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" + asynchronous: model.type != "enum" && model.type != "extruder" onLoaded: { settingLoader.item.showRevertButton = false diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 7430932b65..1ffc2f939f 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -49,7 +49,7 @@ ScrollView //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" + asynchronous: model.type != "enum" && model.type != "extruder" active: model.type != undefined source: From a948c7bcc67fafbc3e32c593a127eac51cd5b6b2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Jun 2016 17:29:26 +0200 Subject: [PATCH 08/12] Set colours of extruder selection to material colour Ubuntu Unity doesn't seem to listen to these colours at all though. Contributes to issues CURA-1278 and CURA-351. --- resources/qml/Settings/SettingExtruder.qml | 60 +++++++++++----------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index 86ab728fc1..0160dab7fa 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -16,17 +16,18 @@ SettingItem { id: control - model: Cura.ExtrudersModel { + model: Cura.ExtrudersModel + { id: extruders_model } - textRole: "name"; + textRole: "name" anchors.fill: parent MouseArea { - anchors.fill: parent; - acceptedButtons: Qt.NoButton; + anchors.fill: parent + acceptedButtons: Qt.NoButton onWheel: wheel.accepted = true; } @@ -38,44 +39,44 @@ SettingItem { if (!enabled) { - return UM.Theme.getColor("setting_control_disabled") + return UM.Theme.getColor("setting_control_disabled"); } if(control.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_control_highlight") + return UM.Theme.getColor("setting_control_highlight"); } else { - return UM.Theme.getColor("setting_control") + return extruders_model.getItem(index).colour; } } - border.width: UM.Theme.getSize("default_lining").width; - border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); + border.width: UM.Theme.getSize("default_lining").width + border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") } label: Item { Label { - anchors.left: parent.left; + anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.right: downArrow.left; - anchors.rightMargin: UM.Theme.getSize("default_lining").width; - anchors.verticalCenter: parent.verticalCenter; + anchors.right: downArrow.left + anchors.rightMargin: UM.Theme.getSize("default_lining").width + anchors.verticalCenter: parent.verticalCenter - text: control.currentText; - font: UM.Theme.getFont("default"); - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text"); + text: control.currentText + font: UM.Theme.getFont("default") + color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : extruders_model.getItem(index).colour - elide: Text.ElideRight; - verticalAlignment: Text.AlignVCenter; + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter } UM.RecolorImage { id: downArrow - anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2; - anchors.verticalCenter: parent.verticalCenter; + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 + anchors.verticalCenter: parent.verticalCenter source: UM.Theme.getIcon("arrow_bottom") width: UM.Theme.getSize("standard_arrow").width @@ -83,29 +84,30 @@ SettingItem sourceSize.width: width + 5 sourceSize.height: width + 5 - color: UM.Theme.getColor("setting_control_text"); - + color: UM.Theme.getColor("setting_control_text") } } } - onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index) + onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index); onModelChanged: updateCurrentIndex(); Connections { target: provider - onPropertiesChanged: control.updateCurrentIndex() + onPropertiesChanged: control.updateCurrentIndex(); } - function updateCurrentIndex() { - for(var i = 0; i < extruders_model.rowCount(); ++i) { - if(extruders_model.getItem(i).index == provider.properties.value) { + function updateCurrentIndex() + { + for(var i = 0; i < extruders_model.rowCount(); ++i) + { + if(extruders_model.getItem(i).index == provider.properties.value) + { currentIndex = i; return; } } - currentIndex = -1; } } From e03c3b95c527347c92939257b44d8d450b41c929 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Mon, 6 Jun 2016 06:36:30 +0100 Subject: [PATCH 09/12] Splashscreen: Another (and last) correction Now all the needed changes should be done. --- cura/CuraSplashScreen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraSplashScreen.py b/cura/CuraSplashScreen.py index 8f677986df..f2810d359b 100644 --- a/cura/CuraSplashScreen.py +++ b/cura/CuraSplashScreen.py @@ -23,7 +23,7 @@ class CuraSplashScreen(QSplashScreen): version = Application.getInstance().getVersion().split("-") buildtype = Application.getInstance().getBuildType() if buildtype: - version += " (%s)" %(buildtype) + version[0] += " (%s)" %(buildtype) painter.setFont(QFont("Proxima Nova Rg", 20 )) painter.drawText(0, 0, 330 * self._scale, 230 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[0]) From 1171bf112c79f3f3586fb0d030d9dea20db9b961 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Mon, 6 Jun 2016 06:43:07 +0100 Subject: [PATCH 10/12] Ignoring Eclipse+PyDev project files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 72ba4bf565..925de00391 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ resources/i18n/x-test *~ *.qm .idea +.project +.pydevproject From b88f2847ef58cf27b4aab96398ef160a483b9c63 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 6 Jun 2016 08:39:38 +0200 Subject: [PATCH 11/12] Fix saving machine instances to the cura profile CURA-340, see https://github.com/Ultimaker/Cura/commit/c79b7bdd7ad2ed7df481f718c87346a489ba5da9 --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 1198f4523d..4f02d2dab5 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -271,7 +271,7 @@ class CuraApplication(QtApplication): file_name = urllib.parse.quote_plus(stack.getId()) + ".stack.cfg" stack_type = stack.getMetaDataEntry("type", None) path = None - if not stack_type: + if not stack_type or stack_type == "machine": path = Resources.getStoragePath(self.ResourceTypes.MachineStack, file_name) elif stack_type == "extruder": path = Resources.getStoragePath(self.ResourceTypes.ExtruderStack, file_name) From a3e5c065727270d5175c6f76d557115ebb17d97b Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Mon, 6 Jun 2016 06:40:34 +0100 Subject: [PATCH 12/12] Adding debian to gitignore Got a link here my packaging files. As Cura does not come with packaging files itself, we can add this ignore here. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 76f470544f..cc21d3092c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ resources/firmware .idea .project .pydevproject + +# Debian packaging +debian/