马子昂 4 months ago
parent 9b06f616fc
commit 446d8d2d32

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

@ -2207,10 +2207,59 @@ class WordStyleMainWindow(QMainWindow):
def show_about(self):
"""显示关于对话框"""
QMessageBox.about(
self, "关于 MagicWord",
"MagicWord - 隐私学习软件\n\n"
"版本: 2.0\n"
# 创建自定义对话框
dialog = QDialog(self)
dialog.setWindowTitle("关于 MagicWord")
dialog.setModal(True)
dialog.setFixedSize(500, 400)
# 创建布局
layout = QVBoxLayout()
# 添加图标和标题布局
header_layout = QHBoxLayout()
# 添加应用程序图标
try:
icon_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "resources", "icons", "app_icon_128X128.png")
if os.path.exists(icon_path):
icon_label = QLabel()
icon_label.setAlignment(Qt.AlignCenter)
pixmap = QPixmap(icon_path)
if not pixmap.isNull():
# 缩放图标到合适大小
scaled_pixmap = pixmap.scaled(80, 80, Qt.KeepAspectRatio, Qt.SmoothTransformation)
icon_label.setPixmap(scaled_pixmap)
header_layout.addWidget(icon_label)
except Exception as e:
print(f"加载图标失败: {e}")
# 添加标题和版本信息
title_layout = QVBoxLayout()
title_label = QLabel("MagicWord")
title_label.setStyleSheet("font-size: 24px; font-weight: bold; color: #0078d7;")
title_label.setAlignment(Qt.AlignCenter)
version_label = QLabel("版本 1.0")
version_label.setStyleSheet("font-size: 14px; color: #666;")
version_label.setAlignment(Qt.AlignCenter)
title_layout.addWidget(title_label)
title_layout.addWidget(version_label)
header_layout.addLayout(title_layout)
layout.addLayout(header_layout)
# 添加分隔线
separator = QFrame()
separator.setFrameShape(QFrame.HLine)
separator.setFrameShadow(QFrame.Sunken)
separator.setStyleSheet("color: #ddd;")
layout.addWidget(separator)
# 添加关于信息
about_text = QLabel(
"隐私学习软件\n\n"
"基于 Microsoft Word 界面设计\n\n"
"功能特色:\n"
"• 仿Word界面设计\n"
@ -2219,6 +2268,123 @@ class WordStyleMainWindow(QMainWindow):
"• 实时进度跟踪\n"
"• 天气和名言显示"
)
about_text.setAlignment(Qt.AlignCenter)
about_text.setStyleSheet("font-size: 12px; line-height: 1.5;")
layout.addWidget(about_text)
# 添加图标展示区域
icons_layout = QVBoxLayout()
icons_title = QLabel("应用程序图标")
icons_title.setAlignment(Qt.AlignCenter)
icons_title.setStyleSheet("font-size: 14px; font-weight: bold; margin-top: 10px;")
icons_layout.addWidget(icons_title)
# 添加不同尺寸的图标
icons_row_layout = QHBoxLayout()
icon_sizes = [
("32x32", "app_icon_32X32.png"),
("64x64", "app_icon_64X64.png"),
("128x128", "app_icon_128X128.png"),
("256x256", "app_icon_256X256.png")
]
for size_name, icon_file in icon_sizes:
try:
icon_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "resources", "icons", icon_file)
if os.path.exists(icon_path):
icon_container = QVBoxLayout()
icon_label = QLabel()
icon_label.setAlignment(Qt.AlignCenter)
pixmap = QPixmap(icon_path)
if not pixmap.isNull():
# 统一显示为32x32大小以便比较
scaled_pixmap = pixmap.scaled(32, 32, Qt.KeepAspectRatio, Qt.SmoothTransformation)
icon_label.setPixmap(scaled_pixmap)
size_label = QLabel(size_name)
size_label.setAlignment(Qt.AlignCenter)
size_label.setStyleSheet("font-size: 10px; color: #888;")
icon_container.addWidget(icon_label)
icon_container.addWidget(size_label)
icons_row_layout.addLayout(icon_container)
except Exception as e:
print(f"加载图标 {icon_file} 失败: {e}")
icons_layout.addLayout(icons_row_layout)
layout.addLayout(icons_layout)
# 添加按钮布局
button_layout = QHBoxLayout()
button_layout.addStretch() # 添加弹性空间使按钮居中
# 添加"沃式烁"按钮
woshishuo_button = QPushButton("沃式烁")
woshishuo_button.clicked.connect(lambda: self.show_woshishuo_image())
button_layout.addWidget(woshishuo_button)
# 添加OK按钮
ok_button = QPushButton("OK")
ok_button.clicked.connect(dialog.accept)
button_layout.addWidget(ok_button)
button_layout.addStretch() # 添加弹性空间使按钮居中
layout.addLayout(button_layout)
dialog.setLayout(layout)
# 显示对话框
dialog.exec_()
def show_woshishuo_image(self):
"""显示沃式烁图片"""
try:
# 图片路径
image_path = os.path.join(os.path.dirname(__file__), "ui", "114514.png")
# 检查图片是否存在
if not os.path.exists(image_path):
QMessageBox.warning(self, "错误", "图片文件不存在: 114514.png")
return
# 创建图片查看对话框
image_dialog = QDialog(self)
image_dialog.setWindowTitle("沃式烁")
image_dialog.setModal(True)
image_dialog.setFixedSize(500, 400)
# 创建布局
layout = QVBoxLayout()
# 添加图片标签
image_label = QLabel()
image_label.setAlignment(Qt.AlignCenter)
image_label.setScaledContents(True)
# 加载图片
pixmap = QPixmap(image_path)
if pixmap.isNull():
QMessageBox.warning(self, "错误", "无法加载图片文件")
return
# 缩放图片以适应对话框
scaled_pixmap = pixmap.scaled(450, 300, Qt.KeepAspectRatio, Qt.SmoothTransformation)
image_label.setPixmap(scaled_pixmap)
layout.addWidget(image_label)
# 添加关闭按钮
close_button = QPushButton("关闭")
close_button.clicked.connect(image_dialog.accept)
layout.addWidget(close_button)
image_dialog.setLayout(layout)
image_dialog.exec_()
except Exception as e:
QMessageBox.warning(self, "错误", f"显示图片时出错: {str(e)}")
def highlight_next_char(self, position, expected_char):
"""高亮显示下一个期望字符"""

Loading…
Cancel
Save