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 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): diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 7abe5b35f5..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"] @@ -449,15 +449,16 @@ 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) + 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/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) 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.")