Commit 7644927d authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

pamhyr: Allow Pamhyr2 script run on tty mode.

Showing with 15 additions and 9 deletions
+15 -9
......@@ -68,10 +68,6 @@ def gui(app:QApplication, conf:Config):
def main():
conf = Config.load()
app = QApplication(sys.argv)
tr = setup_lang(app, conf)
app.installTranslator(tr)
legal_info()
......@@ -81,17 +77,27 @@ def main():
if script == "help":
ret = usage(sys.argv)
elif script == "gui":
ret = gui(app, conf)
elif script == "debug":
conf.debug = True
elif script == "gui" or script == "debug":
if script == "debug":
conf.debug = True
app = QApplication(sys.argv)
tr = setup_lang(app, conf)
app.installTranslator(tr)
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()}")
logger.error(
f"{logger_color_red()}Invalid script name " +
f"'{sys.argv[1]}'{logger_color_reset()}"
)
usage(sys.argv)
sys.exit(-1)
# By default script as no QApplication (allow run script
# in tty mode)
app = None
application = scripts[script](app, conf, sys.argv)
ret = application.run()
if ret != 0:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment