11from PySide6 .QtCore import Qt
2+ from PySide6 .QtGui import QPixmap
23from PySide6 .QtWidgets import (
34 QDialog ,
45 QFileDialog ,
@@ -68,7 +69,7 @@ def _setup(self) -> None:
6869 self .setLabelText (QFileDialog .Reject , "取消" )
6970
7071
71- class AboutMessage (QMessageBox ):
72+ class AboutDlg (QMessageBox ):
7273 """
7374 用于显示关于信息的对话框
7475 """
@@ -78,7 +79,7 @@ def __init__(self, parent: QWidget = None) -> None:
7879 :param parent: 父控件对象
7980 """
8081
81- super (AboutMessage , self ).__init__ (parent )
82+ super (AboutDlg , self ).__init__ (parent )
8283 self ._about_text : str = ""
8384 self ._setup ()
8485
@@ -91,6 +92,9 @@ def _setup(self) -> None:
9192 self .setStandardButtons (QMessageBox .Ok )
9293 self .setTextFormat (Qt .MarkdownText )
9394 self .setText (self .about_text )
95+ self .setIconPixmap (
96+ QPixmap ("py2exe_gui/Resources/Icons/Py2exe-GUI_icon_72px.png" )
97+ )
9498
9599 @property
96100 def about_text (self ) -> str :
@@ -99,11 +103,14 @@ def about_text(self) -> str:
99103 :return: 关于信息
100104 """
101105
102- self ._about_text = (
103- "Py2exe-GUI 是一个[开源程序](https://github.com/muziing/Py2exe-GUI)。\n \n "
104- "旨在为 [PyInstaller](https://pyinstaller.org/) 提供简单易用的图形界面。\n \n "
105- "作者:[muzing](https://muzing.top/about)。"
106- )
106+ try :
107+ with open (
108+ "py2exe_gui/Resources/About.md" , "r" , encoding = "utf-8"
109+ ) as about_file :
110+ self ._about_text = about_file .read ()
111+ except FileNotFoundError :
112+ self ._about_text = "无法打开关于文档,请尝试重新获取本程序。"
113+
107114 return self ._about_text
108115
109116
@@ -157,7 +164,7 @@ def handle_output(self, subprocess_output: tuple[int, str]) -> None:
157164 # window = ScriptFileDlg()
158165 # window = IconFileDlg()
159166 # window.fileSelected.connect(lambda f: print(f)) # type: ignore
160- # window = AboutMessage ()
167+ # window = AboutDlg ()
161168 window = SubProcessDlg ()
162169 window .open ()
163170 sys .exit (app .exec ())
0 commit comments