From 299d05fa713ec59484a4c2ce459f8599227a093a Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 28 Sep 2016 14:23:29 +0200 Subject: [PATCH] Prepend extruder id to extruder quality profiles extruder quality profiles are not shown to the user, so the prepended extruder id is never visible. This way imported profiles behave the same way as normally created profiles. CURA-2478 --- cura/Settings/CuraContainerRegistry.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 17baca305d..460d7ba6c8 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -144,17 +144,18 @@ class CuraContainerRegistry(ContainerRegistry): self._configureProfile(profile, name_seed) return { "status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile.getName()) } else: - new_name = self.createUniqueName("quality_changes", "", name_seed, catalog.i18nc("@label", "Custom profile")) for profile in profile_or_list: + extruder_id = profile.getMetaDataEntry("extruder") + if extruder_id: + profile_name = "%s_%s" % (extruder_id, name_seed) + else: + profile_name = name_seed + new_name = self.createUniqueName("quality_changes", "", profile_name, catalog.i18nc("@label", "Custom profile")) profile.setDirty(True) # Ensure the profiles are correctly saved - self._configureProfile(profile, name_seed) + self._configureProfile(profile, profile_name) profile.setName(new_name) - if len(profile_or_list) == 1: - return {"status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile_or_list[0].getName())} - else: - profile_names = ", ".join([profile.getName() for profile in profile_or_list]) - return { "status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profiles {0}", profile_names) } + return {"status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile_or_list[0].getName())} #If it hasn't returned by now, none of the plugins loaded the profile successfully. return { "status": "error", "message": catalog.i18nc("@info:status", "Profile {0} has an unknown file type.", file_name)}