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:
Tamara Hogenhout 2016-01-15 16:06:01 +01:00
parent 8dc6353738
commit a1be5a080f

View File

@ -271,6 +271,7 @@ class CuraApplication(QtApplication):
@pyqtSlot(str)
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:
self._job_name = name
self.jobNameChanged.emit()
@ -584,9 +585,9 @@ class CuraApplication(QtApplication):
def _onFileLoaded(self, job):
node = job.getResult()
if node != None:
self.setJobName(os.path.basename(job.getFileName()))
node.setSelectable(True)
node.setName(os.path.basename(job.getFileName()))
op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
op.push()