feat: 1.1版本更新 - 优化UI界面和激活流程

This commit is contained in:
ruisu
2025-02-17 20:41:33 +08:00
parent 139c73d9c9
commit 3d9835bd7f
6 changed files with 466 additions and 277 deletions

View File

@@ -114,7 +114,7 @@ class MainWindow(QMainWindow):
def init_ui(self):
# 设置窗口基本属性
self.setWindowTitle('Cursor Pro')
self.setWindowTitle('听泉助手')
self.setMinimumSize(600, 500)
# 设置macOS风格的样式
@@ -183,7 +183,7 @@ class MainWindow(QMainWindow):
layout.setContentsMargins(20, 20, 20, 20)
# 标题
title_label = QLabel("Cursor Pro")
title_label = QLabel("听泉助手")
title_label.setProperty("title", "true")
title_label.setAlignment(Qt.AlignCenter)
layout.addWidget(title_label)
@@ -306,16 +306,51 @@ class MainWindow(QMainWindow):
QMessageBox.critical(self, "错误", f"重置失败: {str(e)}")
def activate_license(self):
license_key = self.activate_input.text().strip()
if not license_key:
QMessageBox.warning(self, "提示", "请输入激活码")
return
"""激活许可证"""
try:
# 这里添加激活码验证逻辑
QMessageBox.information(self, "成功", "激活成功")
license_key = self.activate_input.text().strip()
if not license_key:
QMessageBox.warning(self, "提示", "请输入激活码")
return
# 禁用激活按钮,防止重复点击
self.activate_input.setEnabled(False)
self.update_button.setEnabled(False)
# 显示处理中的提示
QApplication.processEvents()
# 调用激活接口
success, message, account_info = self.updater.check_activation_code(license_key)
if success:
# 更新界面显示
self.member_info.clear()
self.member_info.append(f"会员状态: 已激活")
self.member_info.append(f"到期时间: {account_info['expire_time']}")
self.member_info.append(f"剩余天数: {account_info['days_left']}")
# 显示成功消息
QMessageBox.information(self, "激活成功",
f"设备已成功激活!\n"
f"到期时间: {account_info['expire_time']}\n"
f"剩余天数: {account_info['days_left']}")
# 清空激活码输入框
self.activate_input.clear()
logging.info(f"设备激活成功,到期时间: {account_info['expire_time']}")
else:
QMessageBox.warning(self, "激活失败", message)
logging.error(f"激活失败: {message}")
except Exception as e:
QMessageBox.critical(self, "错误", f"激活失败: {str(e)}")
logging.error(f"激活过程中发生错误: {str(e)}")
QMessageBox.critical(self, "错误", f"激活过程发生错误: {str(e)}")
finally:
# 恢复按钮状态
self.activate_input.setEnabled(True)
self.update_button.setEnabled(True)
def disable_cursor_update(self):
try:
@@ -331,8 +366,8 @@ def main():
logging.info("应用程序启动")
app = QApplication(sys.argv)
app.setApplicationName("CursorPro")
app.setOrganizationName("Cursor")
app.setApplicationName("听泉助手")
app.setOrganizationName("听泉")
app.setOrganizationDomain("cursor.pro")
try: