mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Pamhyr: Add 'gui' as dummy script.
This commit is contained in:
1 parent
d4568ddbb5
commit
4de6784bec
1 file changed
+17
-10
+17
-10
@@ -41,6 +41,7 @@ from init import license, setup_lang
|
||||
logger = logging.getLogger()
|
||||
|
||||
scripts = {
|
||||
"gui" : None,
|
||||
"hello": ScriptHello,
|
||||
}
|
||||
|
||||
@@ -52,6 +53,11 @@ def usage(argv):
|
||||
for s in scripts:
|
||||
logger.info(f"\t{s}\t\t{scripts[s].name}: {scripts[s].description}")
|
||||
|
||||
def gui(app:QApplication, conf:Config):
|
||||
application = ApplicationWindow(conf=conf)
|
||||
application.show()
|
||||
|
||||
return app.exec_()
|
||||
|
||||
def main():
|
||||
conf = Config.load()
|
||||
@@ -66,19 +72,20 @@ def main():
|
||||
# Run a script
|
||||
script = sys.argv[1]
|
||||
|
||||
if script not in scripts:
|
||||
usage(sys.argv)
|
||||
sys.exit(-1)
|
||||
if script == "gui":
|
||||
ret = gui(app, conf)
|
||||
else:
|
||||
if script not in scripts:
|
||||
usage(sys.argv)
|
||||
sys.exit(-1)
|
||||
|
||||
application = scripts[script](sys.argv)
|
||||
ret = application.run()
|
||||
if not ret:
|
||||
application.usage()
|
||||
application = scripts[script](sys.argv)
|
||||
ret = application.run()
|
||||
if not ret:
|
||||
application.usage()
|
||||
else:
|
||||
# No args, run Pamhyr2 interface
|
||||
application = ApplicationWindow(conf=conf)
|
||||
application.show()
|
||||
ret = app.exec_()
|
||||
ret = gui(app, conf)
|
||||
|
||||
display_timers()
|
||||
sys.exit(ret)
|
||||
|
||||
Reference in new issue
Block a user