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
This commit is contained in:
fieldOfView 2016-09-28 14:23:29 +02:00
parent 54d07ae29b
commit 299d05fa71

View File

@ -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) }
#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)}