Also remove instance containers referred to by extruder stacks

Contributes to issue CURA-7024.
This commit is contained in:
Ghostkeeper 2020-02-04 15:33:06 +01:00
parent b549d20ec5
commit 4307942544
No known key found for this signature in database
GPG key ID: 37E2020986774393

View file

@ -90,6 +90,12 @@ class VersionUpgrade44to45(VersionUpgrade):
if "metadata" in parser and "machine" in parser["metadata"] and parser["metadata"]["machine"] in hidden_global_stacks:
stack_id = urllib.parse.unquote_plus(os.path.basename(filename).split(".")[0])
hidden_extruder_stacks.add(stack_id)
# The user container and definition changes container are specific to this stack. We need to delete those too.
if "containers" in parser:
if "0" in parser["containers"]: # User container.
hidden_instance_containers.add(parser["containers"]["0"])
if "6" in parser["containers"]: # Definition changes container.
hidden_instance_containers.add(parser["containers"]["6"])
os.remove(os.path.join(root, filename))
# Walk a third time to remove all instance containers that are referred to by either of those.