diff options
author | Remco Burema <r.burema@ultimaker.com> | 2021-10-20 09:38:01 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2021-10-20 09:38:01 +0300 |
commit | 86046a32b301b1db917a3c1ea0630ae684e640d3 (patch) | |
tree | adbfecccc30d7fb75663820307693a344c018329 /cura/UI | |
parent | 2fc20fd04a8541bc30d6d88e1278ac6f444b81a2 (diff) | |
parent | 7680124f7e9d46a7e52e81cde6b47c39af563cd0 (diff) |
Merge branch 'master' into merge_main_20211019
Diffstat (limited to 'cura/UI')
-rw-r--r-- | cura/UI/PrintInformation.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index d6bd336558..2135c6fe81 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -13,6 +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.OutputDevice import OutputDevice +from UM.OutputDevice.ProjectOutputDevice import ProjectOutputDevice if TYPE_CHECKING: from cura.CuraApplication import CuraApplication @@ -68,6 +70,7 @@ class PrintInformation(QObject): 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.getMachineManager().rootMaterialChanged.connect(self._onActiveMaterialsChanged) self._application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) @@ -439,3 +442,11 @@ class PrintInformation(QObject): """Listen to scene changes to check if we need to reset the print information""" 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.""" + if isinstance(output_device, ProjectOutputDevice): + new_name = output_device.getLastOutputName() + if new_name is not None: + self.setJobName(os.path.splitext(os.path.basename(new_name))[0]) |