更新: 1. 优化程序关闭逻辑,解决临时文件清理问题 2. 更新程序版本到 3.0.4
This commit is contained in:
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
import logging
|
||||
import os
|
||||
from PIL import Image, ImageTk
|
||||
import time
|
||||
sys.path.append(str(Path(__file__).parent.parent))
|
||||
|
||||
from utils.config import Config
|
||||
@@ -276,22 +277,44 @@ class MainWindow:
|
||||
"""窗口关闭处理"""
|
||||
try:
|
||||
logging.info("正在关闭程序...")
|
||||
# 先退出主循环
|
||||
self.root.quit()
|
||||
# 等待一小段时间确保资源释放
|
||||
time.sleep(0.5)
|
||||
except Exception as e:
|
||||
logging.error(f"关闭程序时出错: {str(e)}")
|
||||
finally:
|
||||
self.root.destroy()
|
||||
try:
|
||||
# 销毁窗口
|
||||
self.root.destroy()
|
||||
# 再等待一小段时间
|
||||
time.sleep(0.5)
|
||||
# 强制结束进程
|
||||
if sys.platform == "win32":
|
||||
import os
|
||||
os._exit(0)
|
||||
except:
|
||||
# 如果还是无法正常关闭,直接强制退出
|
||||
os._exit(0)
|
||||
|
||||
def run(self):
|
||||
"""运行程序"""
|
||||
self.root.mainloop()
|
||||
|
||||
def dummy_function(self):
|
||||
"""占位函数"""
|
||||
"""突破版本限制"""
|
||||
# 先检查状态
|
||||
if not self.check_status():
|
||||
return
|
||||
messagebox.showinfo("提示", "此功能暂未实现")
|
||||
|
||||
try:
|
||||
success, message = self.switcher.bypass_version_limit()
|
||||
if success:
|
||||
messagebox.showinfo("成功", message)
|
||||
else:
|
||||
messagebox.showerror("错误", message)
|
||||
except Exception as e:
|
||||
messagebox.showerror("错误", f"操作失败: {str(e)}")
|
||||
|
||||
def reset_machine_id(self):
|
||||
"""刷新Cursor编辑器授权"""
|
||||
|
||||
Reference in New Issue
Block a user