modified: app/amazon/__pycache__/approve.cpython-39.pyc
modified: app/amazon/__pycache__/del_brand.cpython-39.pyc modified: app/amazon/__pycache__/main.cpython-39.pyc new file: app/amazon/__pycache__/match_action.cpython-39.pyc new file: app/amazon/__pycache__/tool.cpython-39.pyc new file: "app/amazon/approve - \345\211\257\346\234\254.py" modified: app/amazon/approve.py modified: app/amazon/del_brand.py modified: app/amazon/main.py new file: app/amazon/match_action.py new file: app/amazon/tool.py modified: app/main.py modified: app/web_source/brand.html
This commit is contained in:
51
app/main.py
51
app/main.py
@@ -57,15 +57,26 @@ class WindowAPI:
|
||||
window.events.restored += lambda _: setattr(self, '_is_maximized', False)
|
||||
|
||||
def close(self):
|
||||
try:
|
||||
kill_process('v6')
|
||||
except Exception as e:
|
||||
print(f"【退出前】关闭紫鸟浏览器进程异常: {str(e)}")
|
||||
"""关闭窗口,异步执行清理逻辑"""
|
||||
def cleanup_and_exit():
|
||||
"""后台清理线程"""
|
||||
try:
|
||||
kill_process('v6')
|
||||
except Exception as e:
|
||||
print(f"【退出前】关闭紫鸟浏览器进程异常: {str(e)}")
|
||||
finally:
|
||||
time.sleep(0.5)
|
||||
os._exit(0)
|
||||
|
||||
# 先销毁窗口,让用户看到立即响应
|
||||
try:
|
||||
self._window.destroy()
|
||||
except:
|
||||
pass
|
||||
os._exit(0) # 强制退出整个进程,包括所有线程
|
||||
|
||||
# 在后台线程执行清理,不阻塞
|
||||
cleanup_thread = threading.Thread(target=cleanup_and_exit, daemon=True)
|
||||
cleanup_thread.start()
|
||||
|
||||
def minimize(self):
|
||||
self._window.minimize()
|
||||
@@ -369,20 +380,24 @@ def start_task_monitor():
|
||||
|
||||
|
||||
def on_window_closing():
|
||||
"""窗口关闭事件处理器,执行与 close() 方法相同的清理逻辑"""
|
||||
# 先关闭窗口,避免看起来卡着
|
||||
try:
|
||||
if webview.windows:
|
||||
webview.windows[0].destroy()
|
||||
except:
|
||||
pass
|
||||
"""窗口关闭事件处理器,异步执行清理逻辑,避免阻塞UI"""
|
||||
def cleanup_and_exit():
|
||||
"""后台清理线程"""
|
||||
try:
|
||||
kill_process('v6')
|
||||
except Exception as e:
|
||||
print(f"【退出前】关闭紫鸟浏览器进程异常: {str(e)}")
|
||||
finally:
|
||||
# 给一点时间让清理完成,然后强制退出
|
||||
time.sleep(0.5)
|
||||
os._exit(0)
|
||||
|
||||
# 然后执行清理逻辑
|
||||
try:
|
||||
kill_process('v6')
|
||||
except Exception as e:
|
||||
print(f"【退出前】关闭紫鸟浏览器进程异常: {str(e)}")
|
||||
os._exit(0) # 强制退出整个进程,包括所有线程
|
||||
# 立即在后台线程执行清理,不阻塞窗口关闭
|
||||
cleanup_thread = threading.Thread(target=cleanup_and_exit, daemon=True)
|
||||
cleanup_thread.start()
|
||||
|
||||
# 立即返回,让窗口快速关闭,用户不会感觉卡顿
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user