From 4d9275d667d693afd0fcd1654ebd9fab436af50a Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Sun, 21 Jan 2024 22:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/mainview.py | 2 +- app/web_ui/templates/christmas.html | 2 ++ main.py | 24 +++++++++++++++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/app/ui/mainview.py b/app/ui/mainview.py index ea22276..1725ebb 100644 --- a/app/ui/mainview.py +++ b/app/ui/mainview.py @@ -266,7 +266,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif): self.outputThread.start() elif self.sender() == self.action_batch_export: dialog = ExportDialog(None, title='批量导出聊天记录', parent=self) - result = dialog.exec_() # 使用exec_()获取用户的操作结果 + result = dialog.exec_() # 使用exec_()获取用户的操作结果 def message(self, msg): self.stopBusy() diff --git a/app/web_ui/templates/christmas.html b/app/web_ui/templates/christmas.html index 6068718..dda6d80 100644 --- a/app/web_ui/templates/christmas.html +++ b/app/web_ui/templates/christmas.html @@ -231,10 +231,12 @@

敬请期待

+ 点击生成我的年度聊天报告

分享此页面

+ https://memotrace.lc044.love/
diff --git a/main.py b/main.py index 9c2a24e..00a9dee 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,8 @@ import sys import time import traceback +from app.ui.Icon import Icon + widget = None @@ -12,9 +14,25 @@ def excepthook(exc_type, exc_value, traceback_): # 在这里处理全局异常 error_message = ''.join(traceback.format_exception(exc_type, exc_value, traceback_)) - msg = f"Exception Type: {exc_type.__name__}\nException Value: {exc_value}\ndetails: {error_message}" + txt = '您可添加QQ群发送log文件以便解决该问题' + msg = f"Exception Type: {exc_type.__name__}\nException Value: {exc_value}\ndetails: {error_message}\n\n{txt}" logger.error(f'程序发生了错误:\n\n{msg}') - QMessageBox.critical(None, "Unhandled Exception", msg, QMessageBox.Ok) + # 创建一个 QMessageBox 对象 + error_box = QMessageBox() + + # 设置对话框的标题 + error_box.setWindowTitle("未知错误") + pixmap = QPixmap(Icon.logo_ico_path) + icon = QIcon(pixmap) + error_box.setWindowIcon(icon) + # 设置对话框的文本消息 + error_box.setText(msg) + # 设置对话框的图标,使用 QMessageBox.Critical 作为图标类型 + error_box.setIcon(QMessageBox.Critical) + # 添加一个“确定”按钮 + error_box.addButton(QMessageBox.Ok) + # 显示对话框 + error_box.exec_() # 调用原始的 excepthook,以便程序正常退出 sys.__excepthook__(exc_type, exc_value, traceback_) @@ -22,7 +40,7 @@ def excepthook(exc_type, exc_value, traceback_): # 设置 excepthook sys.excepthook = excepthook -from PyQt5.QtGui import QFont +from PyQt5.QtGui import QFont, QPixmap, QIcon from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt