Don't re-create user profile if one is loaded from files

The user profiles are also saved because they are added to the container registry. So if one exists for this extruder, don't create a new blank name, but use the pre-loaded one which contained the user settings the user had before he closed down Cura previously.

Contributes to issues CURA-340 and CURA-1278.
This commit is contained in:
Ghostkeeper 2016-06-08 12:22:45 +02:00
parent 163642f9ad
commit f6ece126c3
No known key found for this signature in database
GPG key ID: 701948C5954A7385

View file

@ -147,12 +147,15 @@ class ExtruderManager(QObject):
self._container_stack.addContainer(self._quality)
"""
#Add an empty user profile.
user_profile = UM.Settings.InstanceContainer(extruder_train_id + "_current_settings")
user_profile.addMetaDataEntry("type", "user")
user_profile.setDefinition(machine_definition)
user_profile = container_registry.findInstanceContainers(id = extruder_train_id + "_current_settings")
if user_profile: #There was already a user profile, loaded from settings.
user_profile = user_profile[0]
else:
user_profile = UM.Settings.InstanceContainer(extruder_train_id + "_current_settings") #Add an empty user profile.
user_profile.addMetaDataEntry("type", "user")
user_profile.setDefinition(machine_definition)
container_registry.addContainer(user_profile)
container_stack.addContainer(user_profile)
container_registry.addContainer(user_profile)
container_stack.setNextStack(UM.Application.getInstance().getGlobalContainerStack())