mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Allow Pamhyr2 script run on tty mode.
This commit is contained in:
1 parent
242b1a4e50
commit
7644927de9
1 file changed
+15
-9
+15
-9
@@ -68,10 +68,6 @@ def gui(app:QApplication, conf:Config):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
conf = Config.load()
|
conf = Config.load()
|
||||||
app = QApplication(sys.argv)
|
|
||||||
|
|
||||||
tr = setup_lang(app, conf)
|
|
||||||
app.installTranslator(tr)
|
|
||||||
|
|
||||||
legal_info()
|
legal_info()
|
||||||
|
|
||||||
@@ -81,17 +77,27 @@ def main():
|
|||||||
|
|
||||||
if script == "help":
|
if script == "help":
|
||||||
ret = usage(sys.argv)
|
ret = usage(sys.argv)
|
||||||
elif script == "gui":
|
elif script == "gui" or script == "debug":
|
||||||
ret = gui(app, conf)
|
if script == "debug":
|
||||||
elif script == "debug":
|
conf.debug = True
|
||||||
conf.debug = True
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
tr = setup_lang(app, conf)
|
||||||
|
app.installTranslator(tr)
|
||||||
ret = gui(app, conf)
|
ret = gui(app, conf)
|
||||||
else:
|
else:
|
||||||
if script not in scripts:
|
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)
|
usage(sys.argv)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
# By default script as no QApplication (allow run script
|
||||||
|
# in tty mode)
|
||||||
|
app = None
|
||||||
|
|
||||||
application = scripts[script](app, conf, sys.argv)
|
application = scripts[script](app, conf, sys.argv)
|
||||||
ret = application.run()
|
ret = application.run()
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
|
|||||||
Reference in new issue
Block a user