Handle finished signal for the ReadMeshJob started from command line args

This puts the actual mesh into the scene rather than just loading it and
discarding it afterwards. Now file arguments supplied to the application
actually work.

Fixes "Open With" on Windows and the related Asana issue.
This commit is contained in:
Arjen Hiemstra 2015-06-05 13:25:04 +02:00
parent f57d2693fe
commit a53e56e282

View file

@ -162,6 +162,7 @@ class CuraApplication(QtApplication):
for file in self.getCommandLineOption("file", []): for file in self.getCommandLineOption("file", []):
job = ReadMeshJob(os.path.abspath(file)) job = ReadMeshJob(os.path.abspath(file))
job.finished.connect(self._onFileLoaded)
job.start() job.start()
self.exec_() self.exec_()
@ -447,3 +448,15 @@ class CuraApplication(QtApplication):
def _onMessageActionTriggered(self, message, action): def _onMessageActionTriggered(self, message, action):
if action == "eject": if action == "eject":
self.getStorageDevice("LocalFileStorage").ejectRemovableDrive(message._sdcard) self.getStorageDevice("LocalFileStorage").ejectRemovableDrive(message._sdcard)
def _onFileLoaded(self, job):
mesh = job.getResult()
if mesh != None:
node = SceneNode()
node.setSelectable(True)
node.setMeshData(mesh)
node.setName(os.path.basename(job.getFileName()))
op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
op.push()