mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fix finding existing variant by id
ContainerStack.findContainer cannot find a container by id directly.
This commit is contained in:
parent
78475d68b3
commit
497b6f99a4
1 changed files with 11 additions and 10 deletions
|
@ -32,18 +32,19 @@ class MachineSettingsAction(MachineAction):
|
|||
# First check if there is a variant previously generated by this machine
|
||||
machine_settings_variant = global_container_stack.findContainer({"type": "variant", "subtype": "machine_settings"})
|
||||
if not machine_settings_variant:
|
||||
# There may be a variant created by the UMOUpgradeSelection machine action
|
||||
machine_settings_variant = global_container_stack.findContainer({"type": "variant", "id": global_container_stack.getName() + "_variant"})
|
||||
variant = global_container_stack.findContainer({"type": "variant"})
|
||||
if variant:
|
||||
if variant.getId() == global_container_stack.getName() + "_variant":
|
||||
# There is a variant created by the UMOUpgradeSelection machine action
|
||||
machine_settings_variant = variant
|
||||
if variant.getId() == "empty_variant":
|
||||
# There is an empty variant that we can replace to store the machine settings
|
||||
container_index = global_container_stack.getContainerIndex(variant)
|
||||
machine_settings_variant = self._createMachineSettingsVariant(global_container_stack, container_index)
|
||||
|
||||
if not machine_settings_variant:
|
||||
variant = global_container_stack.findContainer({"type": "variant"})
|
||||
if variant and variant.getId() == "empty_variant":
|
||||
# There is an empty variant that we can use to store the machine settings
|
||||
container_index = global_container_stack.getContainerIndex(variant)
|
||||
machine_settings_variant = self._createMachineSettingsVariant(global_container_stack, container_index)
|
||||
else:
|
||||
# Add a second variant before the current variant to store the machine settings
|
||||
machine_settings_variant = self._createMachineSettingsVariant(global_container_stack)
|
||||
# Add a new variant to store the machine settings
|
||||
machine_settings_variant = self._createMachineSettingsVariant(global_container_stack)
|
||||
|
||||
# Notify the UI in which container to store the machine settings data
|
||||
container_index = global_container_stack.getContainerIndex(machine_settings_variant)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue