From 3e3e6e6b1b93e915cce7daa8e8f2fb61e98b2cb5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 24 Oct 2016 17:39:27 +0200 Subject: [PATCH 1/5] Fix call to _configureProfile The footprint of the function changed, but the call wasn't updated, apparently. I pulled new_name up from one of the if-statements since they need to be computed for both branches now (and they are the same). Contributes to issue CURA-2785. --- cura/Settings/CuraContainerRegistry.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 86fc5335be..41772fb912 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -169,16 +169,15 @@ class CuraContainerRegistry(ContainerRegistry): return { "status": "error", "message": catalog.i18nc("@info:status", "Failed to import profile from {0}: {1}", file_name, str(e))} if profile_or_list: # Success! name_seed = os.path.splitext(os.path.basename(file_name))[0] + new_name = self.uniqueName(name_seed) if type(profile_or_list) is not list: profile = profile_or_list - self._configureProfile(profile, name_seed) + self._configureProfile(profile, name_seed, new_name) return { "status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile.getName()) } else: profile_index = -1 global_profile = None - new_name = self.uniqueName(name_seed) - for profile in profile_or_list: if profile_index >= 0: if len(machine_extruders) > profile_index: From ecbe4b264ad7c782aceb8cea7d952b56a246c339 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 25 Oct 2016 11:02:41 +0200 Subject: [PATCH 2/5] Added handling for key not found in extruder map --- cura/Settings/ExtruderManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index d0da064f92..0236f158aa 100644 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -50,8 +50,11 @@ class ExtruderManager(QObject): @pyqtProperty(int, notify = extrudersChanged) def extruderCount(self): if not UM.Application.getInstance().getGlobalContainerStack(): - return 0 # No active machine, so no extruders. - return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]) + return 0 # No active machine, so no extruders. + try: + return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]) + except KeyError: + return 0 @pyqtProperty("QVariantMap", notify=extrudersChanged) def extruderIds(self): From 844b9729f4f2f8e8ec1e0fea45c1348b8610b73d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 25 Oct 2016 11:16:54 +0200 Subject: [PATCH 3/5] Fixed critical errors when first adding UM3 --- cura/Settings/ProfilesModel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index 6f17349edd..7d39d1c220 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -80,7 +80,10 @@ class ProfilesModel(InstanceContainersModel): quality = quality_result["quality"] break else: #No global container stack in the results: - quality = quality_results[0]["quality"] #Take any of the extruders. + if quality_results: + quality = quality_results[0]["quality"] #Take any of the extruders. + else: + quality = None if quality and quality.hasProperty("layer_height", "value"): item["layer_height"] = str(quality.getProperty("layer_height", "value")) + unit yield item From e6c68bcdc95aa13dca37697fb37865bf28792668 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 25 Oct 2016 11:28:15 +0200 Subject: [PATCH 4/5] Add fallback if no unit is known for layer_height If there is no unit known, it is interpreted as there being no unit. There is currently mm, but if we changed that it is probably on purpose so we write no unit. Contributes to issue CURA-2723. --- cura/Settings/ProfilesModel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index 7d39d1c220..2ad9813e37 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -56,6 +56,8 @@ class ProfilesModel(InstanceContainersModel): machine_manager = Application.getInstance().getMachineManager() unit = global_container_stack.getBottom().getProperty("layer_height", "unit") + if not unit: + unit = "" for item in super()._recomputeItems(): profile = container_registry.findContainers(id = item["id"]) From bef3666a8830501df5c43f6fbd9e25a832381854 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 25 Oct 2016 11:38:22 +0200 Subject: [PATCH 5/5] Still show the inherit button even when the revert is visible It was not a bug like I assumed Contributes to CURA-2752 --- resources/qml/Settings/SettingItem.qml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index f7040976d5..f093150597 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -194,7 +194,6 @@ Item { // Inherit button needs to be visible if; // - User made changes that override any loaded settings // - This setting item uses inherit button at all - // - The revert button is not visible. // - The type of the value of any deeper container is an "object" (eg; is a function) visible: { @@ -203,12 +202,6 @@ Item { return false; } - if(revertButton.visible) - { - // The revert button already indicates there is a custom value for this setting, making this button superfluous. - return false; - } - if(globalPropertyProvider.properties.limit_to_extruder == null || globalPropertyProvider.properties.limit_to_extruder == -1) { return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0;