mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 15:13:56 -06:00
Remove reliance on "_current_settings" postfix when removing user profile containers
CURA-1896
This commit is contained in:
parent
615cfae465
commit
08213890fb
2 changed files with 4 additions and 5 deletions
|
@ -207,12 +207,13 @@ class ExtruderManager(QObject):
|
||||||
#And leave it at the default quality.
|
#And leave it at the default quality.
|
||||||
container_stack.addContainer(quality)
|
container_stack.addContainer(quality)
|
||||||
|
|
||||||
user_profile = container_registry.findInstanceContainers(id = extruder_stack_id + "_current_settings")
|
user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)
|
||||||
if user_profile: #There was already a user profile, loaded from settings.
|
if user_profile: #There was already a user profile, loaded from settings.
|
||||||
user_profile = user_profile[0]
|
user_profile = user_profile[0]
|
||||||
else:
|
else:
|
||||||
user_profile = UM.Settings.InstanceContainer(extruder_stack_id + "_current_settings") #Add an empty user profile.
|
user_profile = UM.Settings.InstanceContainer(extruder_stack_id + "_current_settings") #Add an empty user profile.
|
||||||
user_profile.addMetaDataEntry("type", "user")
|
user_profile.addMetaDataEntry("type", "user")
|
||||||
|
user_profile.addMetaDataEntry("extruder", extruder_stack_id)
|
||||||
user_profile.setDefinition(machine_definition)
|
user_profile.setDefinition(machine_definition)
|
||||||
container_registry.addContainer(user_profile)
|
container_registry.addContainer(user_profile)
|
||||||
container_stack.addContainer(user_profile)
|
container_stack.addContainer(user_profile)
|
||||||
|
@ -226,8 +227,7 @@ class ExtruderManager(QObject):
|
||||||
# \param machine_id The machine to remove the extruders for.
|
# \param machine_id The machine to remove the extruders for.
|
||||||
def removeMachineExtruders(self, machine_id):
|
def removeMachineExtruders(self, machine_id):
|
||||||
for extruder in self.getMachineExtruders(machine_id):
|
for extruder in self.getMachineExtruders(machine_id):
|
||||||
current_settings_id = extruder.getId() + "_current_settings"
|
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "user", extruder = extruder.getId())
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = current_settings_id)
|
|
||||||
for container in containers:
|
for container in containers:
|
||||||
UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId())
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId())
|
||||||
UM.Settings.ContainerRegistry.getInstance().removeContainer(extruder.getId())
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(extruder.getId())
|
||||||
|
|
|
@ -640,8 +640,7 @@ class MachineManager(QObject):
|
||||||
return
|
return
|
||||||
ExtruderManager.getInstance().removeMachineExtruders(stacks[0].getBottom().getId())
|
ExtruderManager.getInstance().removeMachineExtruders(stacks[0].getBottom().getId())
|
||||||
|
|
||||||
current_settings_id = machine_id + "_current_settings"
|
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "user", machine = machine_id)
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = current_settings_id)
|
|
||||||
for container in containers:
|
for container in containers:
|
||||||
UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId())
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId())
|
||||||
UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id)
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue