From 6ad358a55db7dfc4825233a7e453bab31931fba0 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 23 Aug 2021 17:07:36 +0200 Subject: Set the job name whenever the workspaceLoaded is called CURA-8358 --- cura/UI/PrintInformation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cura/UI') diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index d6bd336558..852763cbfd 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -67,7 +67,7 @@ class PrintInformation(QObject): self._application.globalContainerStackChanged.connect(self._updateJobName) self._application.globalContainerStackChanged.connect(self.setToZeroPrintInformation) self._application.fileLoaded.connect(self.setBaseName) - self._application.workspaceLoaded.connect(self.setProjectName) + self._application.workspaceLoaded.connect(self._onWorkspaceLoaded) self._application.getMachineManager().rootMaterialChanged.connect(self._onActiveMaterialsChanged) self._application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) @@ -439,3 +439,7 @@ class PrintInformation(QObject): """Listen to scene changes to check if we need to reset the print information""" self.setToZeroPrintInformation(self._active_build_plate) + + def _onWorkspaceLoaded(self, new_name: str) -> None: + """Update the job name whenever a new workspace is loaded.""" + self.setJobName(os.path.splitext(os.path.basename(new_name))[0]) -- cgit v1.2.3 From c2c53d51c1954315324982bd916b8aad5c19946d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Sep 2021 16:04:05 +0200 Subject: Use optional last output (file) name from output-dev to set project name. Instead of relying on the filename emitted when the workspace is changed. This is done so the user can also change the project name when saving to an output device, such as a local file, or the digital library, that supports changeing the (file)name. CURA-8358 --- cura/UI/PrintInformation.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'cura/UI') diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index 852763cbfd..9640326c91 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -13,6 +13,7 @@ from UM.Qt.Duration import Duration from UM.Scene.SceneNode import SceneNode from UM.i18n import i18nCatalog from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError +from UM.OutputDevice import OutputDevice if TYPE_CHECKING: from cura.CuraApplication import CuraApplication @@ -67,7 +68,8 @@ class PrintInformation(QObject): self._application.globalContainerStackChanged.connect(self._updateJobName) self._application.globalContainerStackChanged.connect(self.setToZeroPrintInformation) self._application.fileLoaded.connect(self.setBaseName) - self._application.workspaceLoaded.connect(self._onWorkspaceLoaded) + self._application.workspaceLoaded.connect(self.setProjectName) + self._application.getOutputDeviceManager().writeStarted.connect(self._onOutputStart) self._application.getMachineManager().rootMaterialChanged.connect(self._onActiveMaterialsChanged) self._application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) @@ -440,6 +442,12 @@ class PrintInformation(QObject): self.setToZeroPrintInformation(self._active_build_plate) - def _onWorkspaceLoaded(self, new_name: str) -> None: - """Update the job name whenever a new workspace is loaded.""" - self.setJobName(os.path.splitext(os.path.basename(new_name))[0]) + def _onOutputStart(self, output_device: OutputDevice) -> None: + """If this is the sort of output 'device' (like local or online file storage, rather than a printer), + the user could have altered the file-name, and thus the project name should be altered as well.""" + new_name = output_device.getLastOutputName() + if new_name is not None: + if len(os.path.dirname(new_name)) > 0: + self.setProjectName(new_name) + else: + self.setJobName(new_name) -- cgit v1.2.3 From b97920e5b155caaab6a8b3bb167853a00ae4b604 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Sep 2021 18:11:10 +0200 Subject: Only change project name when saving to project files. CURA-8358 --- cura/UI/PrintInformation.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'cura/UI') diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index 9640326c91..2bbd12c69f 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -13,7 +13,8 @@ from UM.Qt.Duration import Duration from UM.Scene.SceneNode import SceneNode from UM.i18n import i18nCatalog from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError -from UM.OutputDevice import OutputDevice +from UM.OutputDevice.OutputDevice import OutputDevice +from UM.OutputDevice.ProjectOutputDevice import ProjectOutputDevice if TYPE_CHECKING: from cura.CuraApplication import CuraApplication @@ -445,9 +446,10 @@ class PrintInformation(QObject): def _onOutputStart(self, output_device: OutputDevice) -> None: """If this is the sort of output 'device' (like local or online file storage, rather than a printer), the user could have altered the file-name, and thus the project name should be altered as well.""" - new_name = output_device.getLastOutputName() - if new_name is not None: - if len(os.path.dirname(new_name)) > 0: - self.setProjectName(new_name) - else: - self.setJobName(new_name) + if isinstance(output_device, ProjectOutputDevice): + new_name = output_device.getLastOutputName() + if new_name is not None: + if len(os.path.dirname(new_name)) > 0: + self.setProjectName(new_name) + else: + self.setJobName(new_name) -- cgit v1.2.3 From d68f375e386049878de69eb0b33aacc3f40cb344 Mon Sep 17 00:00:00 2001 From: luz paz Date: Tue, 7 Sep 2021 11:33:54 -0400 Subject: Fix various typos Found via `codespell -q 3 -S *.po,*.pot -L childs,initialy,lod,ned,te,slicable,sur,tutoriels,wont` --- cura/UI/ObjectsModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cura/UI') diff --git a/cura/UI/ObjectsModel.py b/cura/UI/ObjectsModel.py index 0c109d7a4a..64a6e89054 100644 --- a/cura/UI/ObjectsModel.py +++ b/cura/UI/ObjectsModel.py @@ -90,7 +90,7 @@ class ObjectsModel(ListModel): parent = node.getParent() if parent and parent.callDecoration("isGroup"): - return False # Grouped nodes don't need resetting as their parent (the group) is resetted) + return False # Grouped nodes don't need resetting as their parent (the group) is reset) node_build_plate_number = node.callDecoration("getBuildPlateNumber") if Application.getInstance().getPreferences().getValue("view/filter_current_build_plate") and node_build_plate_number != self._build_plate_number: -- cgit v1.2.3 From 9e2b556ce8f28294f9b44a3d8801af42043d3956 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Sep 2021 16:46:39 +0200 Subject: Revert "Only change project name when saving to project files." This reverts commit b97920e5b155caaab6a8b3bb167853a00ae4b604. --- cura/UI/PrintInformation.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cura/UI') diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index 2bbd12c69f..9640326c91 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -13,8 +13,7 @@ from UM.Qt.Duration import Duration from UM.Scene.SceneNode import SceneNode from UM.i18n import i18nCatalog from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError -from UM.OutputDevice.OutputDevice import OutputDevice -from UM.OutputDevice.ProjectOutputDevice import ProjectOutputDevice +from UM.OutputDevice import OutputDevice if TYPE_CHECKING: from cura.CuraApplication import CuraApplication @@ -446,10 +445,9 @@ class PrintInformation(QObject): def _onOutputStart(self, output_device: OutputDevice) -> None: """If this is the sort of output 'device' (like local or online file storage, rather than a printer), the user could have altered the file-name, and thus the project name should be altered as well.""" - if isinstance(output_device, ProjectOutputDevice): - new_name = output_device.getLastOutputName() - if new_name is not None: - if len(os.path.dirname(new_name)) > 0: - self.setProjectName(new_name) - else: - self.setJobName(new_name) + new_name = output_device.getLastOutputName() + if new_name is not None: + if len(os.path.dirname(new_name)) > 0: + self.setProjectName(new_name) + else: + self.setJobName(new_name) -- cgit v1.2.3 From 24ff3692bd5b73828a1c5a58cdd55400cdddad9c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Sep 2021 16:46:53 +0200 Subject: Revert "Use optional last output (file) name from output-dev to set project name." This reverts commit c2c53d51c1954315324982bd916b8aad5c19946d. --- cura/UI/PrintInformation.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'cura/UI') diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index 9640326c91..852763cbfd 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -13,7 +13,6 @@ from UM.Qt.Duration import Duration from UM.Scene.SceneNode import SceneNode from UM.i18n import i18nCatalog from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError -from UM.OutputDevice import OutputDevice if TYPE_CHECKING: from cura.CuraApplication import CuraApplication @@ -68,8 +67,7 @@ class PrintInformation(QObject): self._application.globalContainerStackChanged.connect(self._updateJobName) self._application.globalContainerStackChanged.connect(self.setToZeroPrintInformation) self._application.fileLoaded.connect(self.setBaseName) - self._application.workspaceLoaded.connect(self.setProjectName) - self._application.getOutputDeviceManager().writeStarted.connect(self._onOutputStart) + self._application.workspaceLoaded.connect(self._onWorkspaceLoaded) self._application.getMachineManager().rootMaterialChanged.connect(self._onActiveMaterialsChanged) self._application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) @@ -442,12 +440,6 @@ class PrintInformation(QObject): self.setToZeroPrintInformation(self._active_build_plate) - def _onOutputStart(self, output_device: OutputDevice) -> None: - """If this is the sort of output 'device' (like local or online file storage, rather than a printer), - the user could have altered the file-name, and thus the project name should be altered as well.""" - new_name = output_device.getLastOutputName() - if new_name is not None: - if len(os.path.dirname(new_name)) > 0: - self.setProjectName(new_name) - else: - self.setJobName(new_name) + def _onWorkspaceLoaded(self, new_name: str) -> None: + """Update the job name whenever a new workspace is loaded.""" + self.setJobName(os.path.splitext(os.path.basename(new_name))[0]) -- cgit v1.2.3 From a6a69c249cfc96e19ace64ec01aa7e4fc07a76d1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Sep 2021 16:47:20 +0200 Subject: Revert "Set the job name whenever the workspaceLoaded is called" This reverts commit 6ad358a55db7dfc4825233a7e453bab31931fba0. --- cura/UI/PrintInformation.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'cura/UI') diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index 852763cbfd..d6bd336558 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -67,7 +67,7 @@ class PrintInformation(QObject): self._application.globalContainerStackChanged.connect(self._updateJobName) self._application.globalContainerStackChanged.connect(self.setToZeroPrintInformation) self._application.fileLoaded.connect(self.setBaseName) - self._application.workspaceLoaded.connect(self._onWorkspaceLoaded) + self._application.workspaceLoaded.connect(self.setProjectName) self._application.getMachineManager().rootMaterialChanged.connect(self._onActiveMaterialsChanged) self._application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) @@ -439,7 +439,3 @@ class PrintInformation(QObject): """Listen to scene changes to check if we need to reset the print information""" self.setToZeroPrintInformation(self._active_build_plate) - - def _onWorkspaceLoaded(self, new_name: str) -> None: - """Update the job name whenever a new workspace is loaded.""" - self.setJobName(os.path.splitext(os.path.basename(new_name))[0]) -- cgit v1.2.3