mirror of https://gitlab.com/pamhyr/pamhyr2
Pamhyr: Add 'gui' as dummy script.
parent
d4568ddbb5
commit
4de6784bec
|
|
@ -41,6 +41,7 @@ from init import license, setup_lang
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
scripts = {
|
scripts = {
|
||||||
|
"gui" : None,
|
||||||
"hello": ScriptHello,
|
"hello": ScriptHello,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,6 +53,11 @@ def usage(argv):
|
||||||
for s in scripts:
|
for s in scripts:
|
||||||
logger.info(f"\t{s}\t\t{scripts[s].name}: {scripts[s].description}")
|
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():
|
def main():
|
||||||
conf = Config.load()
|
conf = Config.load()
|
||||||
|
|
@ -66,19 +72,20 @@ def main():
|
||||||
# Run a script
|
# Run a script
|
||||||
script = sys.argv[1]
|
script = sys.argv[1]
|
||||||
|
|
||||||
if script not in scripts:
|
if script == "gui":
|
||||||
usage(sys.argv)
|
ret = gui(app, conf)
|
||||||
sys.exit(-1)
|
else:
|
||||||
|
if script not in scripts:
|
||||||
|
usage(sys.argv)
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
application = scripts[script](sys.argv)
|
application = scripts[script](sys.argv)
|
||||||
ret = application.run()
|
ret = application.run()
|
||||||
if not ret:
|
if not ret:
|
||||||
application.usage()
|
application.usage()
|
||||||
else:
|
else:
|
||||||
# No args, run Pamhyr2 interface
|
# No args, run Pamhyr2 interface
|
||||||
application = ApplicationWindow(conf=conf)
|
ret = gui(app, conf)
|
||||||
application.show()
|
|
||||||
ret = app.exec_()
|
|
||||||
|
|
||||||
display_timers()
|
display_timers()
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue