From 224e6d37a8166c7f8e7ad38a9da2ae022d34cc6d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Sep 2016 10:53:21 +0200 Subject: [PATCH 1/6] Add materialNames property to get user-facing texts from printer inb4 string-freeze CURA-2276 --- cura/PrinterOutputDevice.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 35ca6b7cbb..1071cfeebd 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -24,6 +24,7 @@ class PrinterOutputDevice(QObject, OutputDevice): def __init__(self, device_id, parent = None): super().__init__(device_id = device_id, parent = parent) + self._container_registry = UM.Settings.ContainerRegistry.getInstance() self._target_bed_temperature = 0 self._bed_temperature = 0 self._num_extruders = 1 @@ -276,6 +277,21 @@ class PrinterOutputDevice(QObject, OutputDevice): def materialIds(self): return self._material_ids + @pyqtProperty("QVariantList", notify = materialIdChanged) + def materialNames(self): + result = [] + for material_id in self._material_ids: + if material_id is None: + result.append(i18n_catalog.i18nc("@item:material", "No material loaded")) + continue + + containers = self._container_registry.findInstanceContainers(type = "material", guid = material_id) + if containers: + result.append(containers[0].getName()) + else: + result.append(i18n_catalog.i18nc("@item:material", "Unknown material")) + return result + ## Protected setter for the current material id. # /param index Index of the extruder # /param material_id id of the material From f527da2f3c309d27973ad19e2b513bed5d17e36c Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Sep 2016 11:01:26 +0200 Subject: [PATCH 2/6] Add message to layerview about incompatibility with wireprinting The message is not currently shown yet, but added before the string freeze. CURA-2288 --- plugins/LayerView/LayerView.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 801f4797dd..61182c515a 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -54,6 +54,8 @@ class LayerView(View): self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers")) self._busy = False + self.wireprint_warning_message = Message(i18n_catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled")) + def getActivity(self): return self._activity From 8086646de1e3a95e4f5ea3433645440a399806cd Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 13 Sep 2016 11:30:33 +0200 Subject: [PATCH 3/6] When reverting a user setting be sure to delete it from all of the stacks, global and extruder. Contributes to CURA-2232 No resolvement strategy for prime_tower_enable and platform adhesion --- cura/Settings/MachineManager.py | 12 ++++++++++++ resources/qml/Settings/SettingItem.qml | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1324f3ab60..f2967c7797 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -361,6 +361,18 @@ class MachineManager(QObject): return False + ## Delete a user setting from the global stack and all extruder stacks. + # \param key \type{str} the name of the key to delete + @pyqtSlot(str) + def clearUserSettingAllCurrentStacks(self, key): + if not self._global_container_stack: + return + + self._global_container_stack.getTop().removeInstance(key) + + for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()): + stack.getTop().removeInstance(key) + ## Check if the global profile does not contain error states # Note that the _active_stack_valid is cached due to performance issues # Calling _checkStackForErrors on every change is simply too expensive diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index cdc557a089..671f35f782 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -179,8 +179,8 @@ Item { iconSource: UM.Theme.getIcon("reset") onClicked: { - revertButton.focus = true - propertyProvider.removeFromContainer(0) + revertButton.focus = true; + Cura.MachineManager.clearUserSettingAllCurrentStacks(propertyProvider.key); } onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile.")) } From ebd933282346d3b4595eb9079d05c7a29026423c Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Sep 2016 11:49:27 +0200 Subject: [PATCH 4/6] Fix imports --- plugins/LayerView/LayerView.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 61182c515a..3427ea8a89 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -15,6 +15,8 @@ from UM.Logger import Logger from UM.Scene.SceneNode import SceneNode from UM.View.RenderBatch import RenderBatch from UM.View.GL.OpenGL import OpenGL +from UM.i18n import i18nCatalog +from UM.Message import Message from cura.ConvexHullNode import ConvexHullNode From d907bfb5e35c767ab7f07aeb7b8f0d39bff8632a Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Sep 2016 11:52:18 +0200 Subject: [PATCH 5/6] Fixed copy/paste error --- plugins/LayerView/LayerView.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 3427ea8a89..a431790dd9 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -56,7 +56,7 @@ class LayerView(View): self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers")) self._busy = False - self.wireprint_warning_message = Message(i18n_catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled")) + self.wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled")) def getActivity(self): return self._activity From c43b277901b0bd81978b580460cff0f76e03e739 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Sep 2016 11:53:46 +0200 Subject: [PATCH 6/6] Fixed double import 3rd time lucky? --- plugins/LayerView/LayerView.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index a431790dd9..555b7cf8a7 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -15,7 +15,6 @@ from UM.Logger import Logger from UM.Scene.SceneNode import SceneNode from UM.View.RenderBatch import RenderBatch from UM.View.GL.OpenGL import OpenGL -from UM.i18n import i18nCatalog from UM.Message import Message from cura.ConvexHullNode import ConvexHullNode