Remove duplicate global_stack variable

CURA-7644
This commit is contained in:
Kostas Karmas 2020-10-02 15:21:18 +02:00
parent f2475605c6
commit 524cd48b80

View File

@ -470,20 +470,18 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if id_list[7] != machine_definition_id: if id_list[7] != machine_definition_id:
machine_definition_id = id_list[7] machine_definition_id = id_list[7]
stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine") existing_stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine")
existing_global_stack = None existing_global_stack = None
global_stack = None
self._conflicts_found["machine"] = False self._conflicts_found["machine"] = False
if stacks: if existing_stacks:
global_stack = stacks[0] existing_global_stack = existing_stacks[0]
existing_global_stack = global_stack
self._containers_found["machine"] = True self._containers_found["machine"] = True
# Check if there are any changes at all in any of the container stacks. # Check if there are any changes at all in any of the container stacks.
for index, container_id in enumerate(id_list): for index, container_id in enumerate(id_list):
# take into account the old empty container IDs # take into account the old empty container IDs
container_id = self._old_empty_profile_id_dict.get(container_id, container_id) container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
if global_stack.getContainer(index).getId() != container_id: if existing_global_stack.getContainer(index).getId() != container_id:
self._conflicts_found["machine"] = True self._conflicts_found["machine"] = True
break break
@ -574,11 +572,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
extruder_info.intent_info = instance_container_info_dict[intent_id] extruder_info.intent_info = instance_container_info_dict[intent_id]
# The machine doesn't have conflicts, but if its extruder stacks have, we will still mark it as conflicting # The machine doesn't have conflicts, but if its extruder stacks have, we will still mark it as conflicting
if not self._conflicts_found["machine"] and self._containers_found["machine"] and global_stack: if not self._conflicts_found["machine"] and self._containers_found["machine"] and existing_global_stack:
if int(position) >= len(global_stack.extruderList): if int(position) >= len(existing_global_stack.extruderList):
continue continue
existing_extruder_stack = global_stack.extruderList[int(position)] existing_extruder_stack = existing_global_stack.extruderList[int(position)]
# check if there are any changes at all in any of the container stacks. # check if there are any changes at all in any of the container stacks.
id_list = self._getContainerIdListFromSerialized(serialized_extruder_stack) id_list = self._getContainerIdListFromSerialized(serialized_extruder_stack)
for index, container_id in enumerate(id_list): for index, container_id in enumerate(id_list):