|
|
|
|
@ -33,7 +33,7 @@ from learning_mode_window import LearningModeWindow
|
|
|
|
|
from ui.theme_manager import ThemeManager
|
|
|
|
|
from ui.ai_chat_panel import AIChatPanel
|
|
|
|
|
from ui.snake_game import SnakeGameWindow
|
|
|
|
|
|
|
|
|
|
from ui.minesweeper_game import MinesweeperWindow
|
|
|
|
|
|
|
|
|
|
class MarkTextEditor(QPlainTextEdit):
|
|
|
|
|
"""MarkText风格的Markdown编辑器组件"""
|
|
|
|
|
@ -329,10 +329,10 @@ class MarkTextSideBar(QWidget):
|
|
|
|
|
file_layout = QVBoxLayout()
|
|
|
|
|
file_layout.setSpacing(6)
|
|
|
|
|
|
|
|
|
|
self.new_file_btn = QPushButton("📄 新建文档")
|
|
|
|
|
self.open_file_btn = QPushButton("📁 打开文件")
|
|
|
|
|
self.save_file_btn = QPushButton("💾 保存文件")
|
|
|
|
|
self.export_btn = QPushButton("📤 导出为...")
|
|
|
|
|
self.new_file_btn = QPushButton("新建文档")
|
|
|
|
|
self.open_file_btn = QPushButton("打开文件")
|
|
|
|
|
self.save_file_btn = QPushButton("保存文件")
|
|
|
|
|
self.export_btn = QPushButton("导出为...")
|
|
|
|
|
|
|
|
|
|
file_layout.addWidget(self.new_file_btn)
|
|
|
|
|
file_layout.addWidget(self.open_file_btn)
|
|
|
|
|
@ -347,9 +347,9 @@ class MarkTextSideBar(QWidget):
|
|
|
|
|
learning_layout = QVBoxLayout()
|
|
|
|
|
learning_layout.setSpacing(6)
|
|
|
|
|
|
|
|
|
|
self.typing_mode_btn = QPushButton("⌨️ 打字模式")
|
|
|
|
|
self.learning_mode_btn = QPushButton("📚 学习模式")
|
|
|
|
|
self.import_file_btn = QPushButton("📥 导入学习文件")
|
|
|
|
|
self.typing_mode_btn = QPushButton("打字模式")
|
|
|
|
|
self.learning_mode_btn = QPushButton("学习模式")
|
|
|
|
|
self.import_file_btn = QPushButton("导入学习文件")
|
|
|
|
|
|
|
|
|
|
# 进度显示
|
|
|
|
|
self.progress_label = QLabel("进度: 0%")
|
|
|
|
|
@ -370,14 +370,15 @@ class MarkTextSideBar(QWidget):
|
|
|
|
|
tools_layout = QVBoxLayout()
|
|
|
|
|
tools_layout.setSpacing(6)
|
|
|
|
|
|
|
|
|
|
self.weather_btn = QPushButton("🌤 天气信息")
|
|
|
|
|
self.select_city_btn = QPushButton("🏙 选择城市")
|
|
|
|
|
self.quote_btn = QPushButton("📖 每日名言")
|
|
|
|
|
self.insert_weather_btn = QPushButton("🌈 插入天气")
|
|
|
|
|
self.insert_quote_btn = QPushButton("✨ 插入名言")
|
|
|
|
|
self.calendar_btn = QPushButton("📅 日历功能")
|
|
|
|
|
self.insert_date_btn = QPushButton("📆 插入日期")
|
|
|
|
|
self.snake_game_btn = QPushButton("🐍 贪吃蛇游戏")
|
|
|
|
|
self.weather_btn = QPushButton("天气信息")
|
|
|
|
|
self.select_city_btn = QPushButton("选择城市")
|
|
|
|
|
self.quote_btn = QPushButton("每日名言")
|
|
|
|
|
self.insert_weather_btn = QPushButton("插入天气")
|
|
|
|
|
self.insert_quote_btn = QPushButton("插入名言")
|
|
|
|
|
self.calendar_btn = QPushButton("日历功能")
|
|
|
|
|
self.insert_date_btn = QPushButton("插入日期")
|
|
|
|
|
self.snake_game_btn = QPushButton("贪吃蛇游戏")
|
|
|
|
|
self.minesweeper_game_btn = QPushButton("扫雷游戏")
|
|
|
|
|
|
|
|
|
|
tools_layout.addWidget(self.weather_btn)
|
|
|
|
|
tools_layout.addWidget(self.select_city_btn)
|
|
|
|
|
@ -387,6 +388,7 @@ class MarkTextSideBar(QWidget):
|
|
|
|
|
tools_layout.addWidget(self.calendar_btn)
|
|
|
|
|
tools_layout.addWidget(self.insert_date_btn)
|
|
|
|
|
tools_layout.addWidget(self.snake_game_btn)
|
|
|
|
|
tools_layout.addWidget(self.minesweeper_game_btn)
|
|
|
|
|
|
|
|
|
|
tools_group.setLayout(tools_layout)
|
|
|
|
|
layout.addWidget(tools_group)
|
|
|
|
|
@ -412,6 +414,7 @@ class MarkTextSideBar(QWidget):
|
|
|
|
|
self.calendar_btn.clicked.connect(self.parent.show_calendar_dialog)
|
|
|
|
|
self.insert_date_btn.clicked.connect(self.parent.insert_current_date)
|
|
|
|
|
self.snake_game_btn.clicked.connect(self.parent.open_snake_game)
|
|
|
|
|
self.minesweeper_game_btn.clicked.connect(self.parent.open_minesweeper_game)
|
|
|
|
|
|
|
|
|
|
# 设置固定宽度
|
|
|
|
|
self.setFixedWidth(220)
|
|
|
|
|
@ -445,7 +448,6 @@ class MarkTextMainWindow(QMainWindow):
|
|
|
|
|
self.learning_window = None # 学习模式窗口引用
|
|
|
|
|
|
|
|
|
|
self.setup_ui()
|
|
|
|
|
self.setup_menu()
|
|
|
|
|
self.setup_toolbar()
|
|
|
|
|
self.setup_statusbar()
|
|
|
|
|
self.setup_connections()
|
|
|
|
|
@ -737,239 +739,6 @@ class MarkTextMainWindow(QMainWindow):
|
|
|
|
|
frame.setLayout(main_layout)
|
|
|
|
|
return frame
|
|
|
|
|
|
|
|
|
|
def setup_menu(self):
|
|
|
|
|
"""设置菜单栏 - 修复菜单文字颜色"""
|
|
|
|
|
menubar = self.menuBar()
|
|
|
|
|
menubar.setStyleSheet("""
|
|
|
|
|
QMenuBar {
|
|
|
|
|
background-color: #161b22;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
border-bottom: 1px solid #30363d;
|
|
|
|
|
}
|
|
|
|
|
QMenuBar::item {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
}
|
|
|
|
|
QMenuBar::item:selected {
|
|
|
|
|
background-color: #1f6feb;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
# 文件菜单
|
|
|
|
|
file_menu = menubar.addMenu('文件(&F)')
|
|
|
|
|
file_menu.setStyleSheet("""
|
|
|
|
|
QMenu {
|
|
|
|
|
background-color: #161b22;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
border: 1px solid #30363d;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item:selected {
|
|
|
|
|
background-color: #1f6feb;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
new_action = QAction('新建(&N)', self)
|
|
|
|
|
new_action.setShortcut('Ctrl+N')
|
|
|
|
|
new_action.triggered.connect(self.new_file)
|
|
|
|
|
file_menu.addAction(new_action)
|
|
|
|
|
|
|
|
|
|
open_action = QAction('打开(&O)', self)
|
|
|
|
|
open_action.setShortcut('Ctrl+O')
|
|
|
|
|
open_action.triggered.connect(self.open_file)
|
|
|
|
|
file_menu.addAction(open_action)
|
|
|
|
|
|
|
|
|
|
save_action = QAction('保存(&S)', self)
|
|
|
|
|
save_action.setShortcut('Ctrl+S')
|
|
|
|
|
save_action.triggered.connect(self.save_file)
|
|
|
|
|
file_menu.addAction(save_action)
|
|
|
|
|
|
|
|
|
|
save_as_action = QAction('另存为(&A)...', self)
|
|
|
|
|
save_as_action.setShortcut('Ctrl+Shift+S')
|
|
|
|
|
save_as_action.triggered.connect(self.save_as_file)
|
|
|
|
|
file_menu.addAction(save_as_action)
|
|
|
|
|
|
|
|
|
|
file_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
export_action = QAction('导出(&E)...', self)
|
|
|
|
|
export_action.triggered.connect(self.export_file)
|
|
|
|
|
file_menu.addAction(export_action)
|
|
|
|
|
|
|
|
|
|
file_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
exit_action = QAction('退出(&X)', self)
|
|
|
|
|
exit_action.setShortcut('Ctrl+Q')
|
|
|
|
|
exit_action.triggered.connect(self.close)
|
|
|
|
|
file_menu.addAction(exit_action)
|
|
|
|
|
|
|
|
|
|
# 编辑菜单
|
|
|
|
|
edit_menu = menubar.addMenu('编辑(&E)')
|
|
|
|
|
edit_menu.setStyleSheet("""
|
|
|
|
|
QMenu {
|
|
|
|
|
background-color: #161b22;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
border: 1px solid #30363d;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item:selected {
|
|
|
|
|
background-color: #1f6feb;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
undo_action = QAction('撤销(&U)', self)
|
|
|
|
|
undo_action.setShortcut('Ctrl+Z')
|
|
|
|
|
undo_action.triggered.connect(self.editor_undo)
|
|
|
|
|
edit_menu.addAction(undo_action)
|
|
|
|
|
|
|
|
|
|
redo_action = QAction('重做(&R)', self)
|
|
|
|
|
redo_action.setShortcut('Ctrl+Y')
|
|
|
|
|
redo_action.triggered.connect(self.editor_redo)
|
|
|
|
|
edit_menu.addAction(redo_action)
|
|
|
|
|
|
|
|
|
|
edit_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
cut_action = QAction('剪切(&T)', self)
|
|
|
|
|
cut_action.setShortcut('Ctrl+X')
|
|
|
|
|
cut_action.triggered.connect(self.editor_cut)
|
|
|
|
|
edit_menu.addAction(cut_action)
|
|
|
|
|
|
|
|
|
|
copy_action = QAction('复制(&C)', self)
|
|
|
|
|
copy_action.setShortcut('Ctrl+C')
|
|
|
|
|
copy_action.triggered.connect(self.editor_copy)
|
|
|
|
|
edit_menu.addAction(copy_action)
|
|
|
|
|
|
|
|
|
|
paste_action = QAction('粘贴(&P)', self)
|
|
|
|
|
paste_action.setShortcut('Ctrl+V')
|
|
|
|
|
paste_action.triggered.connect(self.editor_paste)
|
|
|
|
|
edit_menu.addAction(paste_action)
|
|
|
|
|
|
|
|
|
|
edit_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
select_all_action = QAction('全选(&A)', self)
|
|
|
|
|
select_all_action.setShortcut('Ctrl+A')
|
|
|
|
|
select_all_action.triggered.connect(self.editor_select_all)
|
|
|
|
|
edit_menu.addAction(select_all_action)
|
|
|
|
|
|
|
|
|
|
edit_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
# 格式子菜单
|
|
|
|
|
format_menu = edit_menu.addMenu('格式(&F)')
|
|
|
|
|
|
|
|
|
|
italic_action = QAction('斜体(&I)', self)
|
|
|
|
|
italic_action.setShortcut('Ctrl+I')
|
|
|
|
|
italic_action.triggered.connect(self.on_italic_clicked)
|
|
|
|
|
format_menu.addAction(italic_action)
|
|
|
|
|
|
|
|
|
|
underline_action = QAction('下划线(&U)', self)
|
|
|
|
|
underline_action.setShortcut('Ctrl+U')
|
|
|
|
|
underline_action.triggered.connect(self.on_underline_clicked)
|
|
|
|
|
format_menu.addAction(underline_action)
|
|
|
|
|
|
|
|
|
|
format_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
color_action = QAction('字体颜色(&C)...', self)
|
|
|
|
|
color_action.triggered.connect(self.on_color_clicked)
|
|
|
|
|
format_menu.addAction(color_action)
|
|
|
|
|
|
|
|
|
|
bg_color_action = QAction('背景颜色(&G)...', self)
|
|
|
|
|
bg_color_action.triggered.connect(self.on_background_color_clicked)
|
|
|
|
|
format_menu.addAction(bg_color_action)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 工具菜单
|
|
|
|
|
tools_menu = menubar.addMenu('工具(&T)')
|
|
|
|
|
tools_menu.setStyleSheet("""
|
|
|
|
|
QMenu {
|
|
|
|
|
background-color: #161b22;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
border: 1px solid #30363d;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item:selected {
|
|
|
|
|
background-color: #1f6feb;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
weather_action = QAction('天气信息(&W)', self)
|
|
|
|
|
weather_action.triggered.connect(self.show_weather_info)
|
|
|
|
|
tools_menu.addAction(weather_action)
|
|
|
|
|
|
|
|
|
|
quote_action = QAction('每日名言(&Q)', self)
|
|
|
|
|
quote_action.triggered.connect(self.show_quote_info)
|
|
|
|
|
tools_menu.addAction(quote_action)
|
|
|
|
|
|
|
|
|
|
tools_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
# 添加刷新功能
|
|
|
|
|
refresh_weather_action = QAction('刷新天气(&R)', self)
|
|
|
|
|
refresh_weather_action.setShortcut('F5')
|
|
|
|
|
refresh_weather_action.triggered.connect(self.refresh_weather_info)
|
|
|
|
|
tools_menu.addAction(refresh_weather_action)
|
|
|
|
|
|
|
|
|
|
refresh_quote_action = QAction('刷新名言(&F)', self)
|
|
|
|
|
refresh_quote_action.setShortcut('F6')
|
|
|
|
|
refresh_quote_action.triggered.connect(self.refresh_quote_info)
|
|
|
|
|
tools_menu.addAction(refresh_quote_action)
|
|
|
|
|
|
|
|
|
|
tools_menu.addSeparator()
|
|
|
|
|
|
|
|
|
|
insert_weather_action = QAction('插入天气(&I)', self)
|
|
|
|
|
insert_weather_action.triggered.connect(self.insert_weather_to_editor)
|
|
|
|
|
tools_menu.addAction(insert_weather_action)
|
|
|
|
|
|
|
|
|
|
insert_quote_action = QAction('插入名言(&N)', self)
|
|
|
|
|
insert_quote_action.triggered.connect(self.insert_quote_to_editor)
|
|
|
|
|
tools_menu.addAction(insert_quote_action)
|
|
|
|
|
|
|
|
|
|
tools_menu.addSeparator()
|
|
|
|
|
# 主题切换功能已移动到主题菜单中
|
|
|
|
|
|
|
|
|
|
# 学习模式菜单
|
|
|
|
|
learning_menu = menubar.addMenu('学习(&L)')
|
|
|
|
|
learning_menu.setStyleSheet("""
|
|
|
|
|
QMenu {
|
|
|
|
|
background-color: #161b22;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
border: 1px solid #30363d;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item:selected {
|
|
|
|
|
background-color: #1f6feb;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
typing_mode_action = QAction('打字模式(&T)', self)
|
|
|
|
|
typing_mode_action.triggered.connect(self.switch_to_typing_mode)
|
|
|
|
|
learning_menu.addAction(typing_mode_action)
|
|
|
|
|
|
|
|
|
|
learning_mode_action = QAction('学习模式(&L)', self)
|
|
|
|
|
learning_mode_action.triggered.connect(self.switch_to_learning_mode)
|
|
|
|
|
learning_menu.addAction(learning_mode_action)
|
|
|
|
|
|
|
|
|
|
import_file_action = QAction('导入学习文件(&I)', self)
|
|
|
|
|
import_file_action.triggered.connect(self.import_file)
|
|
|
|
|
learning_menu.addAction(import_file_action)
|
|
|
|
|
|
|
|
|
|
# 帮助菜单
|
|
|
|
|
help_menu = menubar.addMenu('帮助(&H)')
|
|
|
|
|
help_menu.setStyleSheet("""
|
|
|
|
|
QMenu {
|
|
|
|
|
background-color: #161b22;
|
|
|
|
|
color: #c9d1d9;
|
|
|
|
|
border: 1px solid #30363d;
|
|
|
|
|
}
|
|
|
|
|
QMenu::item:selected {
|
|
|
|
|
background-color: #1f6feb;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
about_action = QAction('关于(&A)', self)
|
|
|
|
|
about_action.triggered.connect(self.show_about_dialog)
|
|
|
|
|
help_menu.addAction(about_action)
|
|
|
|
|
|
|
|
|
|
def setup_toolbar(self):
|
|
|
|
|
"""设置工具栏"""
|
|
|
|
|
@ -1070,7 +839,12 @@ class MarkTextMainWindow(QMainWindow):
|
|
|
|
|
toolbar.addSeparator()
|
|
|
|
|
toolbar.addAction("刷新天气", self.refresh_weather_info)
|
|
|
|
|
toolbar.addAction("刷新名言", self.refresh_quote_info)
|
|
|
|
|
|
|
|
|
|
toolbar.addSeparator()
|
|
|
|
|
|
|
|
|
|
# 关于按钮
|
|
|
|
|
toolbar.addAction("关于", self.show_about_dialog)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.addToolBar(toolbar)
|
|
|
|
|
|
|
|
|
|
def setup_statusbar(self):
|
|
|
|
|
@ -1336,29 +1110,29 @@ class MarkTextMainWindow(QMainWindow):
|
|
|
|
|
format_layout = QVBoxLayout()
|
|
|
|
|
|
|
|
|
|
# HTML格式
|
|
|
|
|
html_btn = QPushButton("🌐 导出为 HTML")
|
|
|
|
|
html_btn = QPushButton("导出为 HTML")
|
|
|
|
|
html_btn.clicked.connect(lambda: self.export_as_format(editor, "html", dialog))
|
|
|
|
|
format_layout.addWidget(html_btn)
|
|
|
|
|
|
|
|
|
|
# PDF格式
|
|
|
|
|
pdf_btn = QPushButton("📄 导出为 PDF")
|
|
|
|
|
pdf_btn = QPushButton("导出为 PDF")
|
|
|
|
|
pdf_btn.clicked.connect(lambda: self.export_as_format(editor, "pdf", dialog))
|
|
|
|
|
format_layout.addWidget(pdf_btn)
|
|
|
|
|
|
|
|
|
|
# TXT格式
|
|
|
|
|
txt_btn = QPushButton("📝 导出为 TXT")
|
|
|
|
|
txt_btn = QPushButton("导出为 TXT")
|
|
|
|
|
txt_btn.clicked.connect(lambda: self.export_as_format(editor, "txt", dialog))
|
|
|
|
|
format_layout.addWidget(txt_btn)
|
|
|
|
|
|
|
|
|
|
# Markdown格式
|
|
|
|
|
md_btn = QPushButton("📚 导出为 Markdown")
|
|
|
|
|
md_btn = QPushButton("导出为 Markdown")
|
|
|
|
|
md_btn.clicked.connect(lambda: self.export_as_format(editor, "md", dialog))
|
|
|
|
|
format_layout.addWidget(md_btn)
|
|
|
|
|
|
|
|
|
|
layout.addLayout(format_layout)
|
|
|
|
|
|
|
|
|
|
# 取消按钮
|
|
|
|
|
cancel_btn = QPushButton("❌ 取消")
|
|
|
|
|
cancel_btn = QPushButton("取消")
|
|
|
|
|
cancel_btn.setStyleSheet("""
|
|
|
|
|
QPushButton {
|
|
|
|
|
background-color: #21262d;
|
|
|
|
|
@ -1599,6 +1373,14 @@ class MarkTextMainWindow(QMainWindow):
|
|
|
|
|
except Exception as e:
|
|
|
|
|
QMessageBox.critical(self, "错误", f"无法打开贪吃蛇游戏: {str(e)}")
|
|
|
|
|
|
|
|
|
|
def open_minesweeper_game(self):
|
|
|
|
|
"""打开扫雷游戏"""
|
|
|
|
|
try:
|
|
|
|
|
self.minesweeper_window = MinesweeperWindow(self)
|
|
|
|
|
self.minesweeper_window.show()
|
|
|
|
|
except Exception as e:
|
|
|
|
|
QMessageBox.critical(self, "错误", f"无法打开扫雷游戏: {str(e)}")
|
|
|
|
|
|
|
|
|
|
def select_city_and_refresh_weather(self):
|
|
|
|
|
"""选择城市并刷新天气信息"""
|
|
|
|
|
if not self.network_service:
|
|
|
|
|
@ -2207,33 +1989,33 @@ class MarkTextMainWindow(QMainWindow):
|
|
|
|
|
"""更新信息显示 - 优化性能"""
|
|
|
|
|
if not self.network_service:
|
|
|
|
|
# 网络服务未初始化时显示默认信息
|
|
|
|
|
self.weather_label.setText("🌤 天气: 加载中...")
|
|
|
|
|
self.quote_label.setText("📖 名言: 加载中...")
|
|
|
|
|
self.weather_label.setText("天气: 加载中...")
|
|
|
|
|
self.quote_label.setText("名言: 加载中...")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# 获取天气信息
|
|
|
|
|
weather_info = self.network_service.get_weather_info()
|
|
|
|
|
if weather_info:
|
|
|
|
|
weather_text = f"🌤 {weather_info['city']}: {weather_info['temperature']}°C"
|
|
|
|
|
weather_text = f"{weather_info['city']}: {weather_info['temperature']}°C"
|
|
|
|
|
self.weather_label.setText(weather_text)
|
|
|
|
|
else:
|
|
|
|
|
self.weather_label.setText("🌤 天气: 获取失败")
|
|
|
|
|
self.weather_label.setText("天气: 获取失败")
|
|
|
|
|
|
|
|
|
|
# 获取名言 - 显示完整内容,不再截断
|
|
|
|
|
quote_text = self.network_service.get_daily_quote()
|
|
|
|
|
if quote_text:
|
|
|
|
|
# 显示完整名言,不再截断,让滑动区域处理显示
|
|
|
|
|
self.quote_label.setText(f"📖 {quote_text}")
|
|
|
|
|
self.quote_label.setText(f"{quote_text}")
|
|
|
|
|
# 调整标签大小以适应内容
|
|
|
|
|
self.quote_label.adjustSize()
|
|
|
|
|
else:
|
|
|
|
|
self.quote_label.setText("📖 名言: 获取失败")
|
|
|
|
|
self.quote_label.setText("名言: 获取失败")
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f"更新信息失败: {e}")
|
|
|
|
|
self.weather_label.setText("🌤 天气: 获取失败")
|
|
|
|
|
self.quote_label.setText("📖 名言: 获取失败")
|
|
|
|
|
self.weather_label.setText("天气: 获取失败")
|
|
|
|
|
self.quote_label.setText("名言: 获取失败")
|
|
|
|
|
|
|
|
|
|
def closeEvent(self, event):
|
|
|
|
|
"""关闭事件"""
|
|
|
|
|
|