Skip to content

Commit 61dd88c

Browse files
committed
Replenish about text
补充完善关于信息,加入GPL相关声明与图标; 微调主界面,删去占位菜单、更换窗口图标;
1 parent 2234030 commit 61dd88c

3 files changed

Lines changed: 29 additions & 13 deletions

File tree

src/py2exe_gui/Resources/About.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 关于 Py2exe-GUI
2+
3+
Py2exe-GUI 是一个基于 [PyInstaller](https://pyinstaller.org/) 的图形化跨平台打包工具,便于将 Python 代码打包为可执行文件。
4+
5+
本程序为开源软件:所有源代码托管于 [GitHub](https://github.com/muziing/Py2exe-GUI),并通过 [PyPI](https://pypi.org/project/py2exe-gui/) 提供分发。
6+
7+
本程序为自由软件:在自由软件联盟发布的 GNU 通用公共许可协议(第3版或更新的版本)的约束下,你可以对其进行再发布和/或修改。
8+
9+
版权所有 © 2022 [Muzing (muzi2001@foxmail.com)](https://muzing.top/about)

src/py2exe_gui/Widgets/dialog_widgets.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from PySide6.QtCore import Qt
2+
from PySide6.QtGui import QPixmap
23
from 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())

src/py2exe_gui/Widgets/main_window.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from PySide6.QtWidgets import QApplication, QMainWindow, QMenuBar, QStatusBar
44

55
from .center_widget import CenterWidget
6-
from .dialog_widgets import AboutMessage
6+
from .dialog_widgets import AboutDlg
77

88

99
class MainWindow(QMainWindow):
@@ -28,7 +28,7 @@ def _setup(self) -> None:
2828
self.setWindowTitle("Py2exe-GUI")
2929
self.setMinimumSize(320, 350)
3030
# self.resize(800, 600)
31-
self.setWindowIcon(QIcon("../Resources/Icons/Python_128px.png"))
31+
self.setWindowIcon(QIcon("../Resources/Icons/Py2exe-GUI_icon_72px.ico"))
3232

3333
self._setup_menu_bar()
3434
self._setup_status_bar()
@@ -43,9 +43,9 @@ def _setup_menu_bar(self) -> None:
4343
"""
4444

4545
file_menu = self.menu_bar.addMenu("文件(&F)")
46-
file_menu.addAction("打开……") # 暂时只为占位
46+
# file_menu.addAction("打开……") # 暂时只为占位
4747
file_menu.addSeparator()
48-
file_menu.addAction("退出程序(&E)", self.close) # 直接调用close可能整个程序并未完全退出?
48+
file_menu.addAction("退出(&X)", self.close) # 直接调用close可能整个程序并未完全退出?
4949

5050
help_menu = self.menu_bar.addMenu("帮助(&H)")
5151

@@ -63,7 +63,7 @@ def open_url(url: str):
6363
)
6464

6565
about_menu = self.menu_bar.addMenu("关于(&A)")
66-
about_menu.addAction("关于本程序", AboutMessage(self).exec)
66+
about_menu.addAction("关于本程序", AboutDlg(self).exec)
6767
about_menu.addAction("关于 &Qt", QApplication.aboutQt)
6868

6969
def _setup_status_bar(self) -> None:

0 commit comments

Comments
 (0)