2023-03-12, fix thread blocking issue on some special environment.

master
CHUN YU YAO 2023-03-14 08:28:24 +08:00
parent 54e976d457
commit 069ce7669b
3 changed files with 49 additions and 45 deletions

View File

@ -53,7 +53,7 @@ import argparse
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
CONST_APP_VERSION = u"MaxBot (2023.03.11)"
CONST_APP_VERSION = u"MaxBot (2023.03.12)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"

View File

@ -19,8 +19,10 @@ import platform
import json
import webbrowser
import base64
import threading
import subprocess
CONST_APP_VERSION = u"MaxBot (2023.03.11)"
CONST_APP_VERSION = u"MaxBot (2023.03.12)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -314,8 +316,9 @@ def btn_items_run_event(event):
btn_index = int(str(event.widget['text']).split(" ")[1])
global txt_file_name
filename=txt_file_name[btn_index-1].get().strip()
threading.Thread(target=launch_maxbot, args=(filename,)).start()
import subprocess
def launch_maxbot(filename):
if True:
working_dir = os.path.dirname(os.path.realpath(__file__))
if hasattr(sys, 'frozen'):

View File

@ -22,8 +22,9 @@ import pyperclip
import base64
import time
import threading
import subprocess
CONST_APP_VERSION = u"MaxBot (2023.03.11)"
CONST_APP_VERSION = u"MaxBot (2023.03.12)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -846,13 +847,14 @@ def btn_save_act(language_code, slience_mode=False):
def btn_run_clicked(language_code):
import subprocess
print('run button pressed.')
Root_Dir = ""
save_ret = btn_save_act(language_code, slience_mode=True)
print("save config result:", save_ret)
if save_ret:
threading.Thread(target=launch_maxbot).start()
def launch_maxbot():
working_dir = os.path.dirname(os.path.realpath(__file__))
if hasattr(sys, 'frozen'):
print("execute in frozen mode")
@ -2549,7 +2551,6 @@ def load_GUI(root, config_dict):
AutofillTab(tab3, config_dict, language_code, UI_PADDING_X)
RuntimeTab(tab4, config_dict, language_code, UI_PADDING_X)
AboutTab(tab5, language_code)
threading.Thread(target=settings_timer, daemon=True).start()
def main():
@ -2571,7 +2572,6 @@ def main():
load_GUI(root, config_dict)
GUI_SIZE_WIDTH = 510
GUI_SIZE_HEIGHT = 619
@ -2609,6 +2609,7 @@ def main():
root.call('wm', 'iconphoto', root._w, logo)
os.remove(icon_filepath)
threading.Thread(target=settings_timer, daemon=True).start()
root.mainloop()
if __name__ == "__main__":