From 6eb9f5139be9ea269b9193c40d378fdaffbb2e04 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 15 May 2015 15:18:27 +0200 Subject: [PATCH] Add support for loading files from command line Fixes #8 --- src/CuraApplication.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CuraApplication.py b/src/CuraApplication.py index 526bb2b10e..99b206cd19 100644 --- a/src/CuraApplication.py +++ b/src/CuraApplication.py @@ -85,6 +85,9 @@ class CuraApplication(QtApplication): self._plugin_registry.loadPlugin("CuraEngineBackend") + def addCommandLineOptions(self, parser): + parser.add_argument("file", nargs="*", help="Files to load after starting the application.") + def run(self): self._i18n_catalog = i18nCatalog("cura"); @@ -153,6 +156,10 @@ class CuraApplication(QtApplication): if self._engine.rootObjects: self.closeSplash() + for file in self.getCommandLineOption("file", []): + job = ReadMeshJob(os.path.abspath(file)) + job.start() + self.exec_() def registerObjects(self, engine):