From fe6019988c0693230047125a39168188378045d0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 22 Jan 2018 10:53:52 +0100 Subject: [PATCH] CURA-4839 Create variable before asignment --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 7c9d31c47a..3eca1326d0 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -704,6 +704,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # load extruder stack files has_extruder_stack_files = len(extruder_stack_files) > 0 + empty_quality_container = self._container_registry.findInstanceContainers(id = "empty_quality")[0] + empty_quality_changes_container = self._container_registry.findInstanceContainers(id = "empty_quality_changes")[0] try: for extruder_stack_file in extruder_stack_files: container_id = self._stripFileToId(extruder_stack_file) @@ -779,7 +781,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader): self._container_registry.removeContainer(container.getId()) return - # Check quality profiles to make sure that if one stack has the "not supported" quality profile, # all others should have the same. # @@ -811,17 +812,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader): quality_has_been_changed = False if has_not_supported: - empty_quality_container = self._container_registry.findInstanceContainers(id = "empty_quality")[0] for stack in [global_stack] + extruder_stacks_in_use: stack.replaceContainer(_ContainerIndexes.Quality, empty_quality_container) - empty_quality_changes_container = self._container_registry.findInstanceContainers(id = "empty_quality_changes")[0] - for stack in [global_stack] + extruder_stacks_in_use: stack.replaceContainer(_ContainerIndexes.QualityChanges, empty_quality_changes_container) quality_has_been_changed = True else: - empty_quality_changes_container = self._container_registry.findInstanceContainers(id="empty_quality_changes")[0] - # The machine in the project has non-empty quality and there are usable qualities for this machine. # We need to check if the current quality_type is still usable for this machine, if not, then the quality # will be reset to the "preferred quality" if present, otherwise "normal".