Update many files.

Add some description about this project, and now it has a simple UI (made with Qt)

If you don't specify the mode of (interface?) the UI. Launcher will show a crude window that lets you
 select a mode to start the (real) launcher.

Test version data fetching functions. Looks great.
This commit is contained in:
2026-07-10 23:27:21 +08:00
parent c1f7967ff0
commit a93641b26d
9 changed files with 274 additions and 19 deletions
+23 -8
View File
@@ -1,14 +1,12 @@
import os
import sys
import argparse
import logging
from app import Launcher
import tkinter as tk
# Logger configure
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s: %(message)s',
level=logging.INFO,
datefmt='%H:%M:%S')
from core_lib.log.default import DEFAULT_FORMAT, DEFAULT_DATE_FORMAT, get_colorful_handler
def select_mode() -> None | str:
value = None
@@ -49,26 +47,44 @@ def tui_entry():
logger.info("Wow tui is unfinished")
def main():
root_logger = logging.getLogger()
logger = logging.getLogger("Launcher.Main")
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--mode", choices=['lightweight', 'full', 'choice'], default='choice',
help="Select mode (lightweight for tui, full is gui,"
"choice for a mode select window)", required=False)
parser.add_argument("-d", "--debug", action="store_true",
help="Enable debug mode", default=False)
args, unknown = parser.parse_known_args()
for arg in unknown:
logging.warning("Unknown argument '%s'" % arg)
logger.warning("Unknown argument '%s'" % arg)
# args value set
if not hasattr(args, "mode") or args.mode == "choice":
mode = select_mode()
if mode is None:
logging.warning("No mode selected. Exiting...")
logger.warning("No mode selected. Exiting...")
sys.exit(0)
else:
mode = args.mode
debug = args.debug
# Init lib
level = logging.DEBUG if debug else logging.INFO
# Set root logger level and configure handler for colorful log (not sure why I added this)
root_logger.setLevel(level)
root_logger.addHandler(get_colorful_handler())
# Logger configure
logging.basicConfig(format=DEFAULT_FORMAT, datefmt=DEFAULT_DATE_FORMAT, level=level)
# Start (the real) launcher
if mode == 'lightweight':
sys.exit(tui_entry())
elif mode == 'full':
@@ -78,6 +94,5 @@ def main():
logger.error("Unknown mode '%s'" % mode)
sys.exit(1)
if __name__ == '__main__':
main()