Additional unparsed command line options are assumed to be a project path to open
This commit is contained in:
+6
-1
@@ -126,14 +126,18 @@ def main(sysArgs=None):
|
|||||||
confPath = None
|
confPath = None
|
||||||
testMode = False
|
testMode = False
|
||||||
qtStyle = "Fusion"
|
qtStyle = "Fusion"
|
||||||
|
cmdOpen = None
|
||||||
|
|
||||||
# Parse Options
|
# Parse Options
|
||||||
try:
|
try:
|
||||||
inOpts, inArgs = getopt.getopt(sysArgs,shortOpt,longOpt)
|
inOpts, inRemain = getopt.getopt(sysArgs,shortOpt,longOpt)
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print(helpMsg)
|
print(helpMsg)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
if len(inRemain) > 0:
|
||||||
|
cmdOpen = inRemain[0]
|
||||||
|
|
||||||
for inOpt, inArg in inOpts:
|
for inOpt, inArg in inOpts:
|
||||||
if inOpt in ("-h","--help"):
|
if inOpt in ("-h","--help"):
|
||||||
print(helpMsg)
|
print(helpMsg)
|
||||||
@@ -165,6 +169,7 @@ def main(sysArgs=None):
|
|||||||
# Set Config Options
|
# Set Config Options
|
||||||
CONFIG.showGUI = not testMode
|
CONFIG.showGUI = not testMode
|
||||||
CONFIG.debugInfo = debugLevel < logging.INFO
|
CONFIG.debugInfo = debugLevel < logging.INFO
|
||||||
|
CONFIG.cmdOpen = cmdOpen
|
||||||
|
|
||||||
# Set Logging
|
# Set Logging
|
||||||
if showTime: debugStr = timeStr+debugStr
|
if showTime: debugStr = timeStr+debugStr
|
||||||
|
|||||||
+2
-1
@@ -41,6 +41,7 @@ class Config:
|
|||||||
self.appHandle = nw.__package__.lower()
|
self.appHandle = nw.__package__.lower()
|
||||||
self.showGUI = True
|
self.showGUI = True
|
||||||
self.debugInfo = False
|
self.debugInfo = False
|
||||||
|
self.cmdOpen = None
|
||||||
|
|
||||||
# Set Paths
|
# Set Paths
|
||||||
self.confPath = None
|
self.confPath = None
|
||||||
@@ -57,7 +58,7 @@ class Config:
|
|||||||
self.iconPath = None
|
self.iconPath = None
|
||||||
|
|
||||||
# Set default values
|
# Set default values
|
||||||
self.confChanged = False
|
self.confChanged = False
|
||||||
|
|
||||||
## General
|
## General
|
||||||
self.guiTheme = "default"
|
self.guiTheme = "default"
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
logger.debug("GUI initialisation complete")
|
logger.debug("GUI initialisation complete")
|
||||||
|
|
||||||
|
if self.mainConf.cmdOpen is not None:
|
||||||
|
logger.debug("Opening project from additional command line option")
|
||||||
|
self.openProject(self.mainConf.cmdOpen)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def clearGUI(self):
|
def clearGUI(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user