Only change project name when saving to project files.

CURA-8358
This commit is contained in:
Remco Burema 2021-09-01 18:11:10 +02:00
parent c2c53d51c1
commit b97920e5b1
No known key found for this signature in database
GPG key ID: 215C49431D43F98C
2 changed files with 10 additions and 8 deletions

View file

@ -13,7 +13,8 @@ from UM.Qt.Duration import Duration
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeTypeNotFoundError 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: if TYPE_CHECKING:
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
@ -445,6 +446,7 @@ class PrintInformation(QObject):
def _onOutputStart(self, output_device: OutputDevice) -> None: 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), """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.""" 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() new_name = output_device.getLastOutputName()
if new_name is not None: if new_name is not None:
if len(os.path.dirname(new_name)) > 0: if len(os.path.dirname(new_name)) > 0:

View file

@ -604,7 +604,7 @@ class DigitalFactoryController(QObject):
def _saveFileToSelectedProjectHelper(self, filename: str, formats: List[str]) -> None: def _saveFileToSelectedProjectHelper(self, filename: str, formats: List[str]) -> None:
# Indicate we have started sending a job (and propagate any user file name changes back to the open project) # Indicate we have started sending a job (and propagate any user file name changes back to the open project)
self.uploadStarted.emit(filename) self.uploadStarted.emit(filename if "3mf" in formats else None)
library_project_id = self._project_model.items[self._selected_project_idx]["libraryProjectId"] library_project_id = self._project_model.items[self._selected_project_idx]["libraryProjectId"]
library_project_name = self._project_model.items[self._selected_project_idx]["displayName"] library_project_name = self._project_model.items[self._selected_project_idx]["displayName"]