mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-01 02:20:35 +08:00
Opt: Read args/translations only once at startup
This commit is contained in:
8
gui.py
8
gui.py
@@ -121,8 +121,8 @@ class AlasManager:
|
|||||||
|
|
||||||
|
|
||||||
class AlasGUI(Frame):
|
class AlasGUI(Frame):
|
||||||
ALAS_MENU = read_file(filepath_args('menu'))
|
ALAS_MENU: Dict[str, Dict[str, List[str]]]
|
||||||
ALAS_ARGS = read_file(filepath_args('args'))
|
ALAS_ARGS: Dict[str, Dict[str, Dict[str, Dict[str, str]]]]
|
||||||
path_to_idx: Dict[str, str] = {}
|
path_to_idx: Dict[str, str] = {}
|
||||||
idx_to_path: Dict[str, str] = {}
|
idx_to_path: Dict[str, str] = {}
|
||||||
|
|
||||||
@@ -136,6 +136,8 @@ class AlasGUI(Frame):
|
|||||||
Args:
|
Args:
|
||||||
prefix: all idx need to be a valid html, so a random character here
|
prefix: all idx need to be a valid html, so a random character here
|
||||||
"""
|
"""
|
||||||
|
cls.ALAS_MENU = read_file(filepath_args('menu'))
|
||||||
|
cls.ALAS_ARGS = read_file(filepath_args('args'))
|
||||||
i = 0
|
i = 0
|
||||||
for list_path, _ in deep_iter(cls.ALAS_ARGS, depth=3):
|
for list_path, _ in deep_iter(cls.ALAS_ARGS, depth=3):
|
||||||
cls.path_to_idx['.'.join(list_path)] = f'{prefix}{i}'
|
cls.path_to_idx['.'.join(list_path)] = f'{prefix}{i}'
|
||||||
@@ -871,7 +873,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
AlasManager.sync_manager = Manager()
|
AlasManager.sync_manager = Manager()
|
||||||
AlasGUI.shorten_path()
|
AlasGUI.shorten_path()
|
||||||
|
lang.reload()
|
||||||
|
|
||||||
def index():
|
def index():
|
||||||
if args.key != '' and not login(args.key):
|
if args.key != '' and not login(args.key):
|
||||||
|
|||||||
@@ -59,7 +59,4 @@ def reload():
|
|||||||
|
|
||||||
for key in dic_lang["ja-JP"].keys():
|
for key in dic_lang["ja-JP"].keys():
|
||||||
if dic_lang["ja-JP"][key] == key:
|
if dic_lang["ja-JP"][key] == key:
|
||||||
dic_lang["ja-JP"][key] = dic_lang["en-US"][key]
|
dic_lang["ja-JP"][key] = dic_lang["en-US"][key]
|
||||||
|
|
||||||
|
|
||||||
reload()
|
|
||||||
Reference in New Issue
Block a user