From a7a3ba950075cf1d8d4977aa1ea5a649a10045ba Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 22 Nov 2017 13:09:24 +0100 Subject: [PATCH 1/5] Always update the job name when a project file is loaded CURA-4553 --- cura/PrintInformation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 3cced2f85c..f0c29f5b81 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -70,6 +70,7 @@ class PrintInformation(QObject): Application.getInstance().globalContainerStackChanged.connect(self._updateJobName) Application.getInstance().fileLoaded.connect(self.setBaseName) + Application.getInstance().workspaceLoaded.connect(self.setProjectName) Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged) self._active_material_container = None @@ -283,7 +284,11 @@ class PrintInformation(QObject): return self._base_name @pyqtSlot(str) - def setBaseName(self, base_name): + def setProjectName(self, name): + self.setBaseName(name, is_project_file = True) + + @pyqtSlot(str) + def setBaseName(self, base_name, is_project_file = False): # Ensure that we don't use entire path but only filename name = os.path.basename(base_name) @@ -291,15 +296,17 @@ class PrintInformation(QObject): # extension. This cuts the extension off if necessary. name = os.path.splitext(name)[0] + # if this is a profile file, always update the job name # name is "" when I first had some meshes and afterwards I deleted them so the naming should start again is_empty = name == "" - if is_empty or (self._base_name == "" and self._base_name != name): + if is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)): # remove ".curaproject" suffix from (imported) the file name if name.endswith(".curaproject"): name = name[:name.rfind(".curaproject")] self._base_name = name self._updateJobName() + ## Created an acronymn-like abbreviated machine name from the currently active machine name # Called each time the global stack is switched def _setAbbreviatedMachineName(self): From 3b5ed701139b96e37afbe2068eaf543804d0e855 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 22 Nov 2017 16:15:06 +0100 Subject: [PATCH 2/5] CURA-4602 Fixed active custom profile selected check --- cura/Settings/MachineManager.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 002c84fb67..ca929b46fc 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -621,9 +621,16 @@ class MachineManager(QObject): def activeQualityId(self) -> str: if self._active_container_stack: quality = self._active_container_stack.quality + if isinstance(quality, type(self._empty_quality_container)): + return "" quality_changes = self._active_container_stack.qualityChanges - if quality and quality_changes and isinstance(quality_changes, type(self._empty_quality_changes_container)) and not isinstance(quality, type(self._empty_quality_container)): - return quality.getId() + if quality and quality_changes: + if isinstance(quality_changes, type(self._empty_quality_changes_container)): + # It's a built-in profile + return quality.getId() + else: + # Custom profile + return quality_changes.getId() return "" @pyqtProperty(str, notify=activeQualityChanged) From dc105c86a000692f8c88d7c049791d018b210b94 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 22 Nov 2017 16:16:35 +0100 Subject: [PATCH 3/5] Ignore live scripting plug-ins --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ac1e8eba92..f67add62cf 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ plugins/cura-god-mode-plugin plugins/cura-big-flame-graph plugins/cura-siemensnx-plugin plugins/CuraVariSlicePlugin +plugins/CuraLiveScriptingPlugin #Build stuff CMakeCache.txt From 6c3eaca0fd1a545bc7dc59ffc18b32550b99dc07 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 22 Nov 2017 16:22:23 +0100 Subject: [PATCH 4/5] fix loading user changes container for single extruder machine --- cura/Settings/CuraContainerRegistry.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 7abe5b35f5..2c9e15b8c9 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -449,12 +449,11 @@ class CuraContainerRegistry(ContainerRegistry): extruder_stack.setVariantById(variant_id) extruder_stack.setMaterialById("default") extruder_stack.setQualityById("default") - quality_changes_id = "default" if machine.qualityChanges.getId() != "empty_quality_changes": extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id) if extruder_quality_changes_container: quality_changes_id = extruder_quality_changes_container[0].getId() - extruder_stack.setQualityChangesById(quality_changes_id) + extruder_stack.setQualityChangesById(quality_changes_id) self.addContainer(extruder_stack) From 105d7a56154ed8c5323df3b8fc2c61941958da1e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 22 Nov 2017 17:12:53 +0100 Subject: [PATCH 5/5] Return newly added single extruder The workspace reader needs to use it to get the correct material. Contributes to issue CURA-4604. --- cura/Settings/CuraContainerRegistry.py | 4 +++- plugins/3MFReader/ThreeMFWorkspaceReader.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 2c9e15b8c9..1674405824 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry): extruder_stack = None # if extruders are defined in the machine definition use those instead - if machine.extruders and len(machine.extruders) > 0: + if machine.extruders and "0" in machine.extruders: new_extruder_id = machine.extruders["0"].getId() extruder_stack = machine.extruders["0"] @@ -457,6 +457,8 @@ class CuraContainerRegistry(ContainerRegistry): self.addContainer(extruder_stack) + return extruder_stack + # Fix the extruders that were upgraded to ExtruderStack instances during addContainer. # The stacks are now responsible for setting the next stack on deserialize. However, # due to problems with loading order, some stacks may not have the proper next stack diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index a237460bab..aa81399b56 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -746,7 +746,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # If not extruder stacks were saved in the project file (pre 3.1) create one manually # We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this if not extruder_stacks: - self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder") + extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")) except: Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")