mirror of https://gitlab.com/pamhyr/pamhyr2
Script: Add gui, help and debug commands.
parent
4debe830b6
commit
0c0ac93061
|
|
@ -41,17 +41,20 @@ from init import license, setup_lang
|
|||
logger = logging.getLogger()
|
||||
|
||||
scripts = {
|
||||
"gui" : None,
|
||||
"hello": ScriptHello,
|
||||
}
|
||||
|
||||
def usage(argv):
|
||||
logger.error(f"{logger_color_red()}Invalid script name '{argv[1]}'{logger_color_reset()}")
|
||||
logger.info("")
|
||||
logger.info(f"Usage: {argv[0]} <script> <args...>")
|
||||
logger.info(f"")
|
||||
logger.info(f"Valid scripts:")
|
||||
logger.info("")
|
||||
logger.info(f"Available scripts:")
|
||||
logger.info(f"\thelp\t\tDisplay this help")
|
||||
logger.info(f"\tgui\t\tRun Pamhyr graphics user interface (by default)")
|
||||
logger.info(f"\tdebug\t\tRun Pamhyr graphics user interface as debug mode")
|
||||
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].description}")
|
||||
logger.info("")
|
||||
|
||||
def gui(app:QApplication, conf:Config):
|
||||
application = ApplicationWindow(conf=conf)
|
||||
|
|
@ -72,10 +75,16 @@ def main():
|
|||
# Run a script
|
||||
script = sys.argv[1]
|
||||
|
||||
if script == "gui":
|
||||
if script == "help":
|
||||
ret = usage(sys.argv)
|
||||
elif script == "gui":
|
||||
ret = gui(app, conf)
|
||||
elif script == "debug":
|
||||
conf.debug = True
|
||||
ret = gui(app, conf)
|
||||
else:
|
||||
if script not in scripts:
|
||||
logger.error(f"{logger_color_red()}Invalid script name '{sys.argv[1]}'{logger_color_reset()}")
|
||||
usage(sys.argv)
|
||||
sys.exit(-1)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue