mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-26 16:13:55 -06:00
Treat project files the same way as model files for job name
CURA-4553
This commit is contained in:
parent
aeb478bb4b
commit
f8fe6cd455
1 changed files with 2 additions and 17 deletions
|
@ -67,11 +67,9 @@ class PrintInformation(QObject):
|
||||||
self._base_name = ""
|
self._base_name = ""
|
||||||
self._abbr_machine = ""
|
self._abbr_machine = ""
|
||||||
self._job_name = ""
|
self._job_name = ""
|
||||||
self._project_name = ""
|
|
||||||
|
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
|
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
|
||||||
Application.getInstance().fileLoaded.connect(self.setBaseName)
|
Application.getInstance().fileLoaded.connect(self.setBaseName)
|
||||||
Application.getInstance().workspaceLoaded.connect(self.setProjectName)
|
|
||||||
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
||||||
|
|
||||||
self._active_material_container = None
|
self._active_material_container = None
|
||||||
|
@ -253,26 +251,13 @@ class PrintInformation(QObject):
|
||||||
self._job_name = name
|
self._job_name = name
|
||||||
self.jobNameChanged.emit()
|
self.jobNameChanged.emit()
|
||||||
|
|
||||||
@pyqtSlot(str)
|
|
||||||
def setProjectName(self, name):
|
|
||||||
self._project_name = name
|
|
||||||
self.setJobName(name)
|
|
||||||
|
|
||||||
jobNameChanged = pyqtSignal()
|
jobNameChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty(str, notify = jobNameChanged)
|
@pyqtProperty(str, notify = jobNameChanged)
|
||||||
def jobName(self):
|
def jobName(self):
|
||||||
return self._job_name
|
return self._job_name
|
||||||
|
|
||||||
def _updateJobName(self, is_project_name_empty = False):
|
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 != "":
|
|
||||||
if is_project_name_empty:
|
|
||||||
self._project_name = ""
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
if self._base_name == "":
|
if self._base_name == "":
|
||||||
self._job_name = ""
|
self._job_name = ""
|
||||||
self.jobNameChanged.emit()
|
self.jobNameChanged.emit()
|
||||||
|
@ -313,7 +298,7 @@ class PrintInformation(QObject):
|
||||||
if name.endswith(".curaproject"):
|
if name.endswith(".curaproject"):
|
||||||
name = name[:name.rfind(".curaproject")]
|
name = name[:name.rfind(".curaproject")]
|
||||||
self._base_name = name
|
self._base_name = name
|
||||||
self._updateJobName(is_project_name_empty = is_empty)
|
self._updateJobName()
|
||||||
|
|
||||||
## Created an acronymn-like abbreviated machine name from the currently active machine name
|
## Created an acronymn-like abbreviated machine name from the currently active machine name
|
||||||
# Called each time the global stack is switched
|
# Called each time the global stack is switched
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue