mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-15 02:12:29 +12:00
Adds #223: command line parameter to open project
This commit is contained in:
parent
ca39121826
commit
9c635301b5
|
@ -71,6 +71,12 @@ def prepare(tests=False):
|
|||
# later if necessary
|
||||
MW._defaultCursorFlashTime = qApp.cursorFlashTime()
|
||||
|
||||
# Command line project
|
||||
if len(sys.argv) > 1 and sys.argv[1][-4:] == ".msk":
|
||||
if os.path.exists(sys.argv[1]):
|
||||
path = os.path.abspath(sys.argv[1])
|
||||
MW._autoLoadProject = path
|
||||
|
||||
return app, MW
|
||||
|
||||
def launch(MW = None):
|
||||
|
|
|
@ -61,6 +61,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self._lastMDEditView = None
|
||||
self._defaultCursorFlashTime = 1000 # Overriden at startup with system
|
||||
# value. In manuskript.main.
|
||||
self._autoLoadProject = None # Used to load a command line project
|
||||
|
||||
self.readSettings()
|
||||
|
||||
|
|
|
@ -64,7 +64,13 @@ class welcome(QWidget, Ui_welcome):
|
|||
# Auto load last project
|
||||
autoLoad, last = self.getAutoLoadValues()
|
||||
|
||||
if autoLoad and last:
|
||||
if self.mw._autoLoadProject:
|
||||
project = self.mw._autoLoadProject
|
||||
self.mw._autoLoadProject = None
|
||||
self.appendToRecentFiles(project)
|
||||
self.mw.loadProject(project)
|
||||
|
||||
elif autoLoad and last:
|
||||
self.mw.loadProject(last)
|
||||
|
||||
def getAutoLoadValues(self):
|
||||
|
|
Loading…
Reference in a new issue