更新: 1. 优化未激活状态下的购买信息提示框 2. 添加一键复制功能 3. 更新版本到3.0.9
This commit is contained in:
@@ -124,7 +124,7 @@ class MainWindow:
|
||||
self.style.configure("Action.TButton", padding=8)
|
||||
ttk.Button(btn_frame, text="刷新Cursor编辑器授权", command=self.reset_machine_id, style="Action.TButton").pack(fill="x", pady=2)
|
||||
ttk.Button(btn_frame, text="突破Cursor0.45.x限制", command=self.dummy_function, style="Action.TButton").pack(fill="x", pady=2)
|
||||
ttk.Button(btn_frame, text="禁用Cursor版本更新", command=self.dummy_function, style="Action.TButton").pack(fill="x", pady=2)
|
||||
ttk.Button(btn_frame, text="禁用Cursor版本更新", command=self.disable_cursor_update, style="Action.TButton").pack(fill="x", pady=2)
|
||||
|
||||
def copy_device_id(self):
|
||||
"""复制设备ID到剪贴板"""
|
||||
@@ -223,10 +223,7 @@ class MainWindow:
|
||||
self.status_text.config(state="disabled")
|
||||
|
||||
def check_status(self):
|
||||
"""检查会员状态
|
||||
Returns:
|
||||
bool: True 表示激活状态正常,False 表示未激活或已过期
|
||||
"""
|
||||
"""检查会员状态"""
|
||||
try:
|
||||
self.status_var.set("正在检查状态...")
|
||||
self.root.update()
|
||||
@@ -235,7 +232,6 @@ class MainWindow:
|
||||
if status:
|
||||
self.update_status_display(status)
|
||||
if status.get('status') == 'inactive':
|
||||
messagebox.showwarning("警告", "当前设备未激活或激活已失效")
|
||||
self.status_var.set("未激活")
|
||||
return False
|
||||
self.status_var.set("状态检查完成")
|
||||
@@ -245,23 +241,74 @@ class MainWindow:
|
||||
inactive_status = {
|
||||
"hardware_id": self.switcher.hardware_id,
|
||||
"expire_time": "",
|
||||
"days": 0,
|
||||
"days_left": 0,
|
||||
"total_days": 0,
|
||||
"status": "inactive",
|
||||
"last_activation": {}
|
||||
"activation_records": []
|
||||
}
|
||||
self.update_status_display(inactive_status)
|
||||
self.status_var.set("未激活")
|
||||
messagebox.showwarning("警告", "当前设备未激活")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"检查状态失败: {str(e)}")
|
||||
self.status_var.set("状态检查失败")
|
||||
# 显示错误消息
|
||||
messagebox.showerror("错误", f"检查状态失败: {str(e)}")
|
||||
return False
|
||||
|
||||
def show_purchase_info(self):
|
||||
"""显示购买信息"""
|
||||
# 创建自定义对话框
|
||||
dialog = tk.Toplevel(self.root)
|
||||
dialog.title("提示")
|
||||
dialog.geometry("400x280") # 增加高度
|
||||
dialog.resizable(False, False)
|
||||
|
||||
# 设置模态
|
||||
dialog.transient(self.root)
|
||||
dialog.grab_set()
|
||||
|
||||
# 创建提示图标
|
||||
icon_frame = ttk.Frame(dialog)
|
||||
icon_frame.pack(pady=10)
|
||||
ttk.Label(icon_frame, text="ℹ️", font=("Segoe UI", 24)).pack()
|
||||
|
||||
# 创建消息文本
|
||||
message_frame = ttk.Frame(dialog)
|
||||
message_frame.pack(pady=5, padx=20)
|
||||
ttk.Label(message_frame, text="您还不是会员,请先购买激活会员用讯。", font=("Microsoft YaHei UI", 10)).pack()
|
||||
|
||||
# 创建可复制的文本框
|
||||
buy_info = "闲鱼:xxxx\n微信:behikcigar\n网站自助购买:nezhacursor.nosqli.com"
|
||||
text = tk.Text(dialog, height=4, width=40, font=("Microsoft YaHei UI", 9))
|
||||
text.pack(pady=5, padx=20)
|
||||
text.insert("1.0", buy_info)
|
||||
text.config(state="normal") # 允许选择和复制
|
||||
|
||||
# 创建按钮框架
|
||||
btn_frame = ttk.Frame(dialog)
|
||||
btn_frame.pack(pady=10)
|
||||
|
||||
# 复制按钮
|
||||
def copy_info():
|
||||
dialog.clipboard_clear()
|
||||
dialog.clipboard_append(buy_info)
|
||||
messagebox.showinfo("提示", "购买信息已复制到剪贴板", parent=dialog)
|
||||
|
||||
ttk.Button(btn_frame, text="复制信息", command=copy_info).pack(side="left", padx=5)
|
||||
ttk.Button(btn_frame, text="确定", command=dialog.destroy).pack(side="left", padx=5)
|
||||
|
||||
# 设置对话框位置为居中
|
||||
dialog.update_idletasks()
|
||||
width = dialog.winfo_width()
|
||||
height = dialog.winfo_height()
|
||||
x = (dialog.winfo_screenwidth() // 2) - (width // 2)
|
||||
y = (dialog.winfo_screenheight() // 2) - (height // 2)
|
||||
dialog.geometry(f"{width}x{height}+{x}+{y}")
|
||||
|
||||
# 等待对话框关闭
|
||||
self.root.wait_window(dialog)
|
||||
|
||||
def minimize_window(self):
|
||||
"""最小化窗口"""
|
||||
self.root.iconify()
|
||||
@@ -301,10 +348,40 @@ class MainWindow:
|
||||
"""运行程序"""
|
||||
self.root.mainloop()
|
||||
|
||||
def reset_machine_id(self):
|
||||
"""刷新Cursor编辑器授权"""
|
||||
if not self.check_status():
|
||||
self.show_purchase_info()
|
||||
return
|
||||
|
||||
try:
|
||||
success, message = self.switcher.refresh_cursor_auth()
|
||||
if success:
|
||||
messagebox.showinfo("成功", "Cursor编辑器授权刷新成功!\n" + message)
|
||||
else:
|
||||
messagebox.showerror("错误", message)
|
||||
except Exception as e:
|
||||
messagebox.showerror("错误", f"刷新失败: {str(e)}")
|
||||
|
||||
def disable_cursor_update(self):
|
||||
"""禁用Cursor版本更新"""
|
||||
if not self.check_status():
|
||||
self.show_purchase_info()
|
||||
return
|
||||
|
||||
try:
|
||||
success, message = self.switcher.disable_cursor_update()
|
||||
if success:
|
||||
messagebox.showinfo("成功", message)
|
||||
else:
|
||||
messagebox.showerror("错误", message)
|
||||
except Exception as e:
|
||||
messagebox.showerror("错误", f"操作失败: {str(e)}")
|
||||
|
||||
def dummy_function(self):
|
||||
"""突破版本限制"""
|
||||
# 先检查状态
|
||||
if not self.check_status():
|
||||
self.show_purchase_info()
|
||||
return
|
||||
|
||||
try:
|
||||
@@ -314,16 +391,4 @@ class MainWindow:
|
||||
else:
|
||||
messagebox.showerror("错误", message)
|
||||
except Exception as e:
|
||||
messagebox.showerror("错误", f"操作失败: {str(e)}")
|
||||
|
||||
def reset_machine_id(self):
|
||||
"""刷新Cursor编辑器授权"""
|
||||
try:
|
||||
# 刷新授权
|
||||
success, message = self.switcher.refresh_cursor_auth()
|
||||
if success:
|
||||
messagebox.showinfo("成功", "Cursor编辑器授权刷新成功!\n" + message)
|
||||
else:
|
||||
messagebox.showerror("错误", message)
|
||||
except Exception as e:
|
||||
messagebox.showerror("错误", f"刷新失败: {str(e)}")
|
||||
messagebox.showerror("错误", f"操作失败: {str(e)}")
|
||||
Reference in New Issue
Block a user