mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 13:03:59 -06:00
Force use and update the job name with the loaded project file
CURA-4348 - If no project is loaded beforehand and then a model file is loaded, the job name should be determined with the current machine name and the first loaded model name. - If a project is loaded, the job name should be the same as the project name, and it should not change until another project is loaded.
This commit is contained in:
parent
eaa7b75f0e
commit
052ea7d90a
4 changed files with 20 additions and 4 deletions
|
@ -66,10 +66,11 @@ class PrintInformation(QObject):
|
|||
self._base_name = ""
|
||||
self._abbr_machine = ""
|
||||
self._job_name = ""
|
||||
self._project_name = ""
|
||||
|
||||
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
|
||||
Application.getInstance().fileLoaded.connect(self.setBaseName)
|
||||
|
||||
Application.getInstance().projectFileLoaded.connect(self.setProjectName)
|
||||
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
||||
|
||||
self._active_material_container = None
|
||||
|
@ -78,7 +79,6 @@ class PrintInformation(QObject):
|
|||
|
||||
self._material_amounts = []
|
||||
|
||||
|
||||
# Crate cura message translations and using translation keys initialize empty time Duration object for total time
|
||||
# and time for each feature
|
||||
def initializeCuraMessagePrintTimeProperties(self):
|
||||
|
@ -241,6 +241,11 @@ class PrintInformation(QObject):
|
|||
self._job_name = name
|
||||
self.jobNameChanged.emit()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def setProjectName(self, name):
|
||||
self._project_name = name
|
||||
self.setJobName(name)
|
||||
|
||||
jobNameChanged = pyqtSignal()
|
||||
|
||||
@pyqtProperty(str, notify = jobNameChanged)
|
||||
|
@ -248,6 +253,11 @@ class PrintInformation(QObject):
|
|||
return self._job_name
|
||||
|
||||
def _updateJobName(self):
|
||||
# if the project name is set, we use the project name as the job name, so the job name should not get updated
|
||||
# if a model file is loaded after that.
|
||||
if self._project_name != "":
|
||||
return
|
||||
|
||||
if self._base_name == "":
|
||||
self._job_name = ""
|
||||
self.jobNameChanged.emit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue