diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index fccd796c1e..548d23ac5b 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: 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): diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index 6f17349edd..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"]) @@ -80,7 +82,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 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;