Removed code duplication

CURA-4053
This commit is contained in:
Jaime van Kessel 2017-07-21 10:15:20 +02:00
parent 4d0c46508a
commit 326c4cc4a4

View file

@ -254,12 +254,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
for index, container_id in enumerate(id_list):
# take into account the old empty container IDs
container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
# HACK: there used to be 5, now we have one more 5 - definition changes
if len(id_list) == 6 and index == 5:
if global_stack.getContainer(5).getId() != "empty":
machine_conflict = True
break
index = 6
if global_stack.getContainer(index).getId() != container_id:
machine_conflict = True
break
@ -295,12 +289,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
for index, container_id in enumerate(id_list):
# take into account the old empty container IDs
container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
# HACK: there used to be 5, now we have one more 5 - definition changes
if len(id_list) == 6 and index == 5:
if existing_extruder_stack.getContainer(5).getId() != "empty":
machine_conflict = True
break
index = 6
if existing_extruder_stack.getContainer(index).getId() != container_id:
machine_conflict = True
break
@ -875,6 +863,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
container_list = container_string.split(",")
container_ids = [container_id for container_id in container_list if container_id != ""]
if len(container_ids) == 5:
# Hack; We used to not save the definition changes. Fix this.
container_ids.insert(4, "empty")
return container_ids
def _getMachineNameFromSerializedStack(self, serialized):