优化界面提示:1. 统一所有提示框样式,使用自定义美观对话框 2. 添加复制按钮功能,方便用户操作 3. 优化未激活会员时的提示信息展示
This commit is contained in:
@@ -6,7 +6,7 @@ from PIL import Image
|
|||||||
from PyQt5.QtWidgets import (QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
|
from PyQt5.QtWidgets import (QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
|
||||||
QLabel, QLineEdit, QPushButton, QFrame, QTextEdit,
|
QLabel, QLineEdit, QPushButton, QFrame, QTextEdit,
|
||||||
QMessageBox, QApplication, QSystemTrayIcon, QMenu,
|
QMessageBox, QApplication, QSystemTrayIcon, QMenu,
|
||||||
QDialog, QProgressBar)
|
QDialog, QProgressBar, QStyle)
|
||||||
from PyQt5.QtCore import Qt, QTimer, QThread, pyqtSignal
|
from PyQt5.QtCore import Qt, QTimer, QThread, pyqtSignal
|
||||||
from PyQt5.QtGui import QIcon, QPixmap
|
from PyQt5.QtGui import QIcon, QPixmap
|
||||||
|
|
||||||
@@ -162,6 +162,23 @@ class MainWindow(QMainWindow):
|
|||||||
# 激活区域
|
# 激活区域
|
||||||
activation_frame = QFrame()
|
activation_frame = QFrame()
|
||||||
activation_layout = QVBoxLayout(activation_frame)
|
activation_layout = QVBoxLayout(activation_frame)
|
||||||
|
|
||||||
|
# 使用说明
|
||||||
|
usage_label = QLabel()
|
||||||
|
usage_label.setText("使用说明:\n\n1. 输入激活码并点击激活\n2. 激活成功后点击\"刷新Cursor编辑器授权\"即可正常使用\n3. 如果刷新无效,请点击\"突破Cursor0.45.x限制\"\n4. 建议点击\"禁用Cursor版本更新\"保持长期稳定")
|
||||||
|
usage_label.setStyleSheet("""
|
||||||
|
QLabel {
|
||||||
|
color: #6c757d;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
activation_layout.addWidget(usage_label)
|
||||||
|
|
||||||
|
# 激活码输入区域
|
||||||
activation_layout.addWidget(QLabel("激活(叠加)会员,多个激活码可叠加整体时长"))
|
activation_layout.addWidget(QLabel("激活(叠加)会员,多个激活码可叠加整体时长"))
|
||||||
input_frame = QFrame()
|
input_frame = QFrame()
|
||||||
input_layout = QHBoxLayout(input_frame)
|
input_layout = QHBoxLayout(input_frame)
|
||||||
@@ -274,23 +291,92 @@ class MainWindow(QMainWindow):
|
|||||||
"""激活账号"""
|
"""激活账号"""
|
||||||
code = self.activation_edit.text().strip()
|
code = self.activation_edit.text().strip()
|
||||||
if not code:
|
if not code:
|
||||||
msg = QMessageBox(self)
|
# 创建自定义消息框
|
||||||
|
msg = QDialog(self)
|
||||||
msg.setWindowTitle("提示")
|
msg.setWindowTitle("提示")
|
||||||
msg.setText("请输入激活码")
|
msg.setFixedWidth(400)
|
||||||
msg.setIcon(QMessageBox.Warning)
|
msg.setWindowFlags(msg.windowFlags() & ~Qt.WindowContextHelpButtonHint)
|
||||||
msg.setStyleSheet("""
|
|
||||||
QMessageBox {
|
# 创建布局
|
||||||
background-color: #f8f9fa;
|
layout = QVBoxLayout()
|
||||||
min-width: 400px;
|
|
||||||
padding: 20px;
|
# 添加图标和文本
|
||||||
}
|
icon_label = QLabel()
|
||||||
QMessageBox QLabel {
|
icon_label.setPixmap(self.style().standardIcon(QStyle.SP_MessageBoxWarning).pixmap(32, 32))
|
||||||
|
icon_label.setAlignment(Qt.AlignCenter)
|
||||||
|
layout.addWidget(icon_label)
|
||||||
|
|
||||||
|
text_label = QLabel("请输入激活码")
|
||||||
|
text_label.setAlignment(Qt.AlignCenter)
|
||||||
|
text_label.setStyleSheet("font-size: 14px; font-weight: bold; color: #333333; padding: 10px;")
|
||||||
|
layout.addWidget(text_label)
|
||||||
|
|
||||||
|
# 添加购买信息
|
||||||
|
info_text = "获取会员激活码,请通过以下方式:\n\n" \
|
||||||
|
"• 官方自助网站:cursor.nosqli.com\n" \
|
||||||
|
"• 微信客服:behikcigar\n" \
|
||||||
|
"• 闲鱼店铺:xxx\n\n" \
|
||||||
|
"————————————————————\n" \
|
||||||
|
"诚招代理商,欢迎加盟合作!"
|
||||||
|
|
||||||
|
info_label = QLabel(info_text)
|
||||||
|
info_label.setAlignment(Qt.AlignLeft)
|
||||||
|
info_label.setStyleSheet("""
|
||||||
|
QLabel {
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
min-height: 40px;
|
padding: 15px;
|
||||||
padding: 10px;
|
background-color: #f8f9fa;
|
||||||
qproperty-alignment: AlignCenter;
|
border-radius: 4px;
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
""")
|
||||||
|
layout.addWidget(info_label)
|
||||||
|
|
||||||
|
# 添加复制按钮区域
|
||||||
|
btn_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
# 复制网站按钮
|
||||||
|
copy_web_btn = QPushButton("复制网站")
|
||||||
|
copy_web_btn.clicked.connect(lambda: self.copy_and_show_tip(msg, "cursor.nosqli.com", "网站地址已复制到剪贴板"))
|
||||||
|
copy_web_btn.setStyleSheet("""
|
||||||
|
QPushButton {
|
||||||
|
background-color: #0d6efd;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #0b5ed7;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
btn_layout.addWidget(copy_web_btn)
|
||||||
|
|
||||||
|
# 复制微信按钮
|
||||||
|
copy_wx_btn = QPushButton("复制微信")
|
||||||
|
copy_wx_btn.clicked.connect(lambda: self.copy_and_show_tip(msg, "behikcigar", "微信号已复制到剪贴板"))
|
||||||
|
copy_wx_btn.setStyleSheet("""
|
||||||
|
QPushButton {
|
||||||
|
background-color: #198754;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #157347;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
btn_layout.addWidget(copy_wx_btn)
|
||||||
|
|
||||||
|
# 确定按钮
|
||||||
|
ok_btn = QPushButton("确定")
|
||||||
|
ok_btn.clicked.connect(msg.accept)
|
||||||
|
ok_btn.setStyleSheet("""
|
||||||
QPushButton {
|
QPushButton {
|
||||||
background-color: #0d6efd;
|
background-color: #0d6efd;
|
||||||
color: white;
|
color: white;
|
||||||
@@ -299,12 +385,15 @@ class MainWindow(QMainWindow):
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
margin: 10px;
|
|
||||||
}
|
}
|
||||||
QPushButton:hover {
|
QPushButton:hover {
|
||||||
background-color: #0b5ed7;
|
background-color: #0b5ed7;
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
|
btn_layout.addWidget(ok_btn)
|
||||||
|
|
||||||
|
layout.addLayout(btn_layout)
|
||||||
|
msg.setLayout(layout)
|
||||||
msg.exec_()
|
msg.exec_()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -355,6 +444,11 @@ class MainWindow(QMainWindow):
|
|||||||
""")
|
""")
|
||||||
msg.exec_()
|
msg.exec_()
|
||||||
|
|
||||||
|
def copy_and_show_tip(self, parent, text, tip):
|
||||||
|
"""复制文本并显示提示"""
|
||||||
|
QApplication.clipboard().setText(text)
|
||||||
|
QMessageBox.information(parent, "提示", tip)
|
||||||
|
|
||||||
def on_activation_complete(self, result):
|
def on_activation_complete(self, result):
|
||||||
"""激活完成回调"""
|
"""激活完成回调"""
|
||||||
success, data = result
|
success, data = result
|
||||||
@@ -579,45 +673,92 @@ class MainWindow(QMainWindow):
|
|||||||
return self.check_status()
|
return self.check_status()
|
||||||
|
|
||||||
if not self._activation_status:
|
if not self._activation_status:
|
||||||
msg = QMessageBox(self)
|
# 创建自定义消息框
|
||||||
|
msg = QDialog(self)
|
||||||
msg.setWindowTitle("会员未激活")
|
msg.setWindowTitle("会员未激活")
|
||||||
msg.setText("您还未激活会员或会员已过期")
|
msg.setFixedWidth(400)
|
||||||
msg.setInformativeText(
|
msg.setWindowFlags(msg.windowFlags() & ~Qt.WindowContextHelpButtonHint)
|
||||||
"获取会员激活码,请通过以下方式:\n\n"
|
|
||||||
" • 官方自助网站:cursor.nosqli.com\n"
|
# 创建布局
|
||||||
" • 微信客服:behikcigar\n"
|
layout = QVBoxLayout()
|
||||||
" • 闲鱼店铺:xxx\n\n"
|
|
||||||
"————————————————————\n"
|
# 添加图标和文本
|
||||||
"诚招代理商,欢迎加盟合作!"
|
icon_label = QLabel()
|
||||||
)
|
icon_label.setPixmap(self.style().standardIcon(QStyle.SP_MessageBoxWarning).pixmap(32, 32))
|
||||||
msg.setIcon(QMessageBox.Information)
|
icon_label.setAlignment(Qt.AlignCenter)
|
||||||
msg.setStyleSheet("""
|
layout.addWidget(icon_label)
|
||||||
QMessageBox {
|
|
||||||
background-color: #f8f9fa;
|
text_label = QLabel("您还未激活会员或会员已过期")
|
||||||
min-width: 400px;
|
text_label.setAlignment(Qt.AlignCenter)
|
||||||
padding: 20px;
|
text_label.setStyleSheet("font-size: 14px; font-weight: bold; color: #333333; padding: 10px;")
|
||||||
}
|
layout.addWidget(text_label)
|
||||||
QMessageBox QLabel {
|
|
||||||
|
# 添加购买信息
|
||||||
|
info_text = "获取会员激活码,请通过以下方式:\n\n" \
|
||||||
|
"• 官方自助网站:cursor.nosqli.com\n" \
|
||||||
|
"• 微信客服:behikcigar\n" \
|
||||||
|
"• 闲鱼店铺:xxx\n\n" \
|
||||||
|
"————————————————————\n" \
|
||||||
|
"诚招代理商,欢迎加盟合作!"
|
||||||
|
|
||||||
|
info_label = QLabel(info_text)
|
||||||
|
info_label.setAlignment(Qt.AlignLeft)
|
||||||
|
info_label.setStyleSheet("""
|
||||||
|
QLabel {
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 10px;
|
padding: 15px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
QMessageBox QLabel:first-child {
|
""")
|
||||||
font-weight: bold;
|
layout.addWidget(info_label)
|
||||||
font-size: 16px;
|
|
||||||
color: #0d6efd;
|
# 添加复制按钮区域
|
||||||
qproperty-alignment: AlignCenter;
|
btn_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
# 复制网站按钮
|
||||||
|
copy_web_btn = QPushButton("复制网站")
|
||||||
|
copy_web_btn.clicked.connect(lambda: self.copy_and_show_tip(msg, "cursor.nosqli.com", "网站地址已复制到剪贴板"))
|
||||||
|
copy_web_btn.setStyleSheet("""
|
||||||
|
QPushButton {
|
||||||
|
background-color: #0d6efd;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
QMessageBox QLabel:last-child {
|
QPushButton:hover {
|
||||||
font-family: 'Microsoft YaHei', sans-serif;
|
background-color: #0b5ed7;
|
||||||
font-size: 14px;
|
|
||||||
color: #333333;
|
|
||||||
padding: 15px;
|
|
||||||
margin: 5px;
|
|
||||||
line-height: 1.8;
|
|
||||||
qproperty-alignment: AlignLeft;
|
|
||||||
}
|
}
|
||||||
|
""")
|
||||||
|
btn_layout.addWidget(copy_web_btn)
|
||||||
|
|
||||||
|
# 复制微信按钮
|
||||||
|
copy_wx_btn = QPushButton("复制微信")
|
||||||
|
copy_wx_btn.clicked.connect(lambda: self.copy_and_show_tip(msg, "behikcigar", "微信号已复制到剪贴板"))
|
||||||
|
copy_wx_btn.setStyleSheet("""
|
||||||
|
QPushButton {
|
||||||
|
background-color: #198754;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #157347;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
btn_layout.addWidget(copy_wx_btn)
|
||||||
|
|
||||||
|
# 确定按钮
|
||||||
|
ok_btn = QPushButton("确定")
|
||||||
|
ok_btn.clicked.connect(msg.accept)
|
||||||
|
ok_btn.setStyleSheet("""
|
||||||
QPushButton {
|
QPushButton {
|
||||||
background-color: #0d6efd;
|
background-color: #0d6efd;
|
||||||
color: white;
|
color: white;
|
||||||
@@ -626,12 +767,15 @@ class MainWindow(QMainWindow):
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
margin: 10px;
|
|
||||||
}
|
}
|
||||||
QPushButton:hover {
|
QPushButton:hover {
|
||||||
background-color: #0b5ed7;
|
background-color: #0b5ed7;
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
|
btn_layout.addWidget(ok_btn)
|
||||||
|
|
||||||
|
layout.addLayout(btn_layout)
|
||||||
|
msg.setLayout(layout)
|
||||||
msg.exec_()
|
msg.exec_()
|
||||||
|
|
||||||
return self._activation_status
|
return self._activation_status
|
||||||
@@ -652,7 +796,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.hide_loading_dialog()
|
self.hide_loading_dialog()
|
||||||
QMessageBox.critical(self, "错误", f"刷新授权失败: {str(e)}")
|
self.show_custom_error("刷新授权失败", str(e))
|
||||||
|
|
||||||
def on_refresh_auth_complete(self, result):
|
def on_refresh_auth_complete(self, result):
|
||||||
"""刷新授权完成回调"""
|
"""刷新授权完成回调"""
|
||||||
@@ -662,11 +806,11 @@ class MainWindow(QMainWindow):
|
|||||||
if isinstance(data, tuple):
|
if isinstance(data, tuple):
|
||||||
success, message = data
|
success, message = data
|
||||||
if success:
|
if success:
|
||||||
QMessageBox.information(self, "成功", message)
|
self.show_custom_message("成功", "刷新授权成功", message, QStyle.SP_DialogApplyButton, "#198754")
|
||||||
else:
|
else:
|
||||||
QMessageBox.critical(self, "失败", message)
|
self.show_custom_error("刷新授权失败", message)
|
||||||
else:
|
else:
|
||||||
QMessageBox.critical(self, "错误", f"刷新授权失败: {data}")
|
self.show_custom_error("刷新授权失败", str(data))
|
||||||
|
|
||||||
def disable_cursor_update(self):
|
def disable_cursor_update(self):
|
||||||
"""禁用Cursor更新"""
|
"""禁用Cursor更新"""
|
||||||
@@ -676,15 +820,98 @@ class MainWindow(QMainWindow):
|
|||||||
try:
|
try:
|
||||||
success, message = self.switcher.disable_cursor_update()
|
success, message = self.switcher.disable_cursor_update()
|
||||||
if success:
|
if success:
|
||||||
QMessageBox.information(self, "成功", message)
|
self.show_custom_message("成功", "禁用更新成功", message, QStyle.SP_DialogApplyButton, "#198754")
|
||||||
else:
|
else:
|
||||||
QMessageBox.critical(self, "失败", message)
|
self.show_custom_error("禁用更新失败", message)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QMessageBox.critical(self, "错误", f"禁用更新失败: {str(e)}")
|
self.show_custom_error("禁用更新失败", str(e))
|
||||||
|
|
||||||
def dummy_function(self):
|
def dummy_function(self):
|
||||||
"""突破版本限制"""
|
"""突破版本限制"""
|
||||||
if not self.check_activation_status():
|
if not self.check_activation_status():
|
||||||
return
|
return
|
||||||
|
|
||||||
QMessageBox.information(self, "提示", "此功能暂未实现")
|
self.show_custom_message(
|
||||||
|
"提示",
|
||||||
|
"功能未实现",
|
||||||
|
"此功能暂未实现,请等待后续更新。",
|
||||||
|
QStyle.SP_MessageBoxInformation,
|
||||||
|
"#0d6efd"
|
||||||
|
)
|
||||||
|
|
||||||
|
def show_custom_message(self, title, header, message, icon_type, color):
|
||||||
|
"""显示自定义消息框"""
|
||||||
|
msg = QDialog(self)
|
||||||
|
msg.setWindowTitle(title)
|
||||||
|
msg.setFixedWidth(400)
|
||||||
|
msg.setWindowFlags(msg.windowFlags() & ~Qt.WindowContextHelpButtonHint)
|
||||||
|
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
|
# 添加图标
|
||||||
|
icon_label = QLabel()
|
||||||
|
icon_label.setPixmap(self.style().standardIcon(icon_type).pixmap(32, 32))
|
||||||
|
icon_label.setAlignment(Qt.AlignCenter)
|
||||||
|
layout.addWidget(icon_label)
|
||||||
|
|
||||||
|
# 添加标题
|
||||||
|
text_label = QLabel(header)
|
||||||
|
text_label.setAlignment(Qt.AlignCenter)
|
||||||
|
text_label.setStyleSheet(f"""
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: {color};
|
||||||
|
padding: 10px;
|
||||||
|
""")
|
||||||
|
layout.addWidget(text_label)
|
||||||
|
|
||||||
|
# 添加详细信息
|
||||||
|
info_label = QLabel(message)
|
||||||
|
info_label.setAlignment(Qt.AlignLeft)
|
||||||
|
info_label.setWordWrap(True)
|
||||||
|
info_label.setStyleSheet("""
|
||||||
|
QLabel {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 15px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
layout.addWidget(info_label)
|
||||||
|
|
||||||
|
# 确定按钮
|
||||||
|
btn_layout = QHBoxLayout()
|
||||||
|
ok_btn = QPushButton("确定")
|
||||||
|
ok_btn.clicked.connect(msg.accept)
|
||||||
|
ok_btn.setStyleSheet(f"""
|
||||||
|
QPushButton {{
|
||||||
|
background-color: {color};
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 25px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
min-width: 100px;
|
||||||
|
}}
|
||||||
|
QPushButton:hover {{
|
||||||
|
background-color: {color.replace('fd', 'd7') if 'fd' in color else color.replace('54', '47')};
|
||||||
|
}}
|
||||||
|
""")
|
||||||
|
btn_layout.addWidget(ok_btn)
|
||||||
|
|
||||||
|
layout.addLayout(btn_layout)
|
||||||
|
msg.setLayout(layout)
|
||||||
|
msg.exec_()
|
||||||
|
|
||||||
|
def show_custom_error(self, header, message):
|
||||||
|
"""显示自定义错误消息框"""
|
||||||
|
self.show_custom_message(
|
||||||
|
"错误",
|
||||||
|
header,
|
||||||
|
message,
|
||||||
|
QStyle.SP_MessageBoxCritical,
|
||||||
|
"#dc3545"
|
||||||
|
)
|
||||||
@@ -1 +1 @@
|
|||||||
3.3.2
|
3.3.4
|
||||||
Reference in New Issue
Block a user