mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-01 16:24:41 +08:00
Allows for a file to be opened using the terminal
or something alike for instance when the file is dragged onto the logo(MacOS) or with 'open with'(Windows) Fixes to #CURA-707 Fixes to #CURA-620 Fixes #591
This commit is contained in:
parent
8dc6353738
commit
a1be5a080f
@ -271,6 +271,7 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def setJobName(self, name):
|
def setJobName(self, name):
|
||||||
|
name = os.path.splitext(name)[0] #when a file is opened using the terminal; the filename comes from _onFileLoaded and still contains its extension. This cuts the extension off if nescessary.
|
||||||
if self._job_name != name:
|
if self._job_name != name:
|
||||||
self._job_name = name
|
self._job_name = name
|
||||||
self.jobNameChanged.emit()
|
self.jobNameChanged.emit()
|
||||||
@ -584,9 +585,9 @@ class CuraApplication(QtApplication):
|
|||||||
def _onFileLoaded(self, job):
|
def _onFileLoaded(self, job):
|
||||||
node = job.getResult()
|
node = job.getResult()
|
||||||
if node != None:
|
if node != None:
|
||||||
|
self.setJobName(os.path.basename(job.getFileName()))
|
||||||
node.setSelectable(True)
|
node.setSelectable(True)
|
||||||
node.setName(os.path.basename(job.getFileName()))
|
node.setName(os.path.basename(job.getFileName()))
|
||||||
|
|
||||||
op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
|
op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user