Refactor config_launcher.py to simplify code and improve readability
parent
882504cebc
commit
6715769c9c
|
@ -183,32 +183,22 @@ def btn_save_act(slience_mode=True):
|
||||||
config_dict = get_default_config()
|
config_dict = get_default_config()
|
||||||
language_code = get_language_code_by_name(config_dict["advanced"]["language"])
|
language_code = get_language_code_by_name(config_dict["advanced"]["language"])
|
||||||
|
|
||||||
is_all_data_correct = True
|
|
||||||
|
|
||||||
global combo_language
|
global combo_language
|
||||||
if is_all_data_correct:
|
config_dict["advanced"]["language"] = combo_language.get().strip()
|
||||||
config_dict["advanced"]["language"] = combo_language.get().strip()
|
# display as new language.
|
||||||
# display as new language.
|
language_code = get_language_code_by_name(config_dict["advanced"]["language"])
|
||||||
language_code = get_language_code_by_name(config_dict["advanced"]["language"])
|
|
||||||
|
|
||||||
|
|
||||||
global txt_file_name
|
global txt_file_name
|
||||||
filelist = []
|
filelist = [txt_file_name[i].get().strip() for i in range(15)]
|
||||||
for i in range(15):
|
config_dict["list"] = filelist
|
||||||
filelist.append(txt_file_name[i].get().strip())
|
|
||||||
|
|
||||||
if is_all_data_correct:
|
|
||||||
config_dict["list"]=filelist
|
|
||||||
|
|
||||||
# save config.
|
# save config.
|
||||||
if is_all_data_correct:
|
util.save_json(config_dict, config_filepath)
|
||||||
# slience
|
|
||||||
util.save_json(config_dict, config_filepath)
|
if not slience_mode:
|
||||||
|
messagebox.showinfo(translate[language_code]["save"], translate[language_code]["done"])
|
||||||
if not slience_mode:
|
|
||||||
messagebox.showinfo(translate[language_code]["save"], translate[language_code]["done"])
|
|
||||||
|
|
||||||
return is_all_data_correct
|
return True
|
||||||
|
|
||||||
def open_url(url):
|
def open_url(url):
|
||||||
webbrowser.open_new(url)
|
webbrowser.open_new(url)
|
||||||
|
|
Loading…
Reference in New Issue