Skip to content

Commit f5b3793

Browse files
committed
Version 0.3.0
新功能: - 初步实现用户浏览选择其他 Python 解释器环境功能; - 可以根据路径名称规律简单推断 Python 环境类型; 修复与优化: - 修复因类型错误导致不能正确处理 option_error 的问题,用户输入错误时能够得到正确的警告提示了; - 大幅完善与优化 docstrings,使符合 Sphinx 风格; - 添加各模块的 `__all__` 白名单入口,模块成员更清晰; - 将部分控件的从属关系进行调整优化; - 略微优化性能;
1 parent 8e48c32 commit f5b3793

4 files changed

Lines changed: 42 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "py2exe-gui"
3-
version = "0.2.1"
3+
version = "0.3.0"
44
description = "GUI for PyInstaller, based on PySide6"
55
keywords = ["PyInstaller", "GUI", "PySide6"]
66
authors = ["muzing <muzi2001@foxmail.com>"]
@@ -9,7 +9,7 @@ readme = ["README.md", "README_zh.md"]
99
repository = "https://github.com/muziing/Py2exe-GUI"
1010
exclude = ["src/py2exe_gui/Resources/Icons", "src/py2exe_gui/Resources/Texts"]
1111
classifiers = [
12-
"Development Status :: 3 - Alpha",
12+
"Development Status :: 4 - Beta",
1313
"Operating System :: Microsoft :: Windows",
1414
"Operating System :: POSIX :: Linux",
1515
"Operating System :: MacOS"

src/py2exe_gui/Constants/app_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AppConstant:
2424
"""应用程序级的常量"""
2525

2626
NAME = "Py2exe-GUI"
27-
VERSION = "0.2.1"
27+
VERSION = "0.3.0"
2828
AUTHORS = ["muzing <muzi2001@foxmail.com>"]
2929
LICENSE = "GPL-3.0-or-later"
3030
HOME_PAGE = APP_URLs["HOME_PAGE"]

src/py2exe_gui/Widgets/arguments_browser.py

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
"""此模块主要包含用于在界面上预览显示 PyInstaller 命令选项的 `ArgumentsBrowser` 类
55
"""
66

7+
__all__ = ["get_line_continuation", "ArgumentsBrowser"]
8+
79
from typing import Optional
810

9-
from PySide6.QtWidgets import QTextBrowser, QWidget
11+
from PySide6.QtGui import QContextMenuEvent
12+
from PySide6.QtWidgets import QMenu, QTextBrowser, QWidget
1013

1114
from ..Constants import RUNTIME_INFO, Platform
1215

@@ -53,20 +56,48 @@ def __init__(self, parent: Optional[QWidget] = None) -> None:
5356

5457
super().__init__(parent)
5558

59+
# 右键菜单
60+
self.context_menu = QMenu(self)
61+
copy_action = self.context_menu.addAction("复制")
62+
copy_action.triggered.connect(self._handle_copy_action)
63+
export_action = self.context_menu.addAction("导出")
64+
export_action.triggered.connect(self._handle_export_action)
65+
66+
def contextMenuEvent(self, event: QContextMenuEvent) -> None:
67+
"""重写右键菜单事件
68+
69+
:param event: 事件
70+
"""
71+
72+
self.context_menu.exec(event.globalPos())
73+
74+
def _handle_copy_action(self) -> None:
75+
"""处理复制事件"""
76+
77+
# TODO 实现复制到系统剪切板
78+
self.copy()
79+
80+
def _handle_export_action(self) -> None:
81+
"""处理导出事件"""
82+
83+
# TODO 实现到处到 PowerShell/Bash 脚本
84+
pass
85+
5686
def enrich_args_text(self, args_list: list[str]) -> None:
5787
"""对参数进行一定高亮美化后显示
5888
5989
:param args_list: 参数列表
6090
"""
6191

62-
enriched_arg_texts: list[str] = [
63-
wrap_font_tag(args_list[0], color=colors[4])
64-
] # 首个参数一定为待打包的 Python 脚本名
92+
# 不间断换行(续行)符
93+
line_continuation = get_line_continuation() + "<br>" + ("&nbsp;" * 4)
94+
95+
# 首个参数一定为待打包的 Python 脚本名
96+
enriched_arg_texts: list[str] = [wrap_font_tag(args_list[0], color=colors[4])]
97+
6598
for arg in args_list[1:]:
6699
if arg.startswith("--") or arg.startswith("-"):
67-
enriched_arg_texts.append(
68-
get_line_continuation() + "<br>" + "&nbsp;&nbsp;&nbsp;&nbsp;"
69-
) # 添加换行,便于阅读与复制导出脚本
100+
enriched_arg_texts.append(line_continuation) # 添加换行,便于阅读与复制导出脚本
70101
enriched_arg_texts.append(wrap_font_tag(arg, color=colors[1]))
71102
else:
72103
enriched_arg_texts.append(arg)

src/py2exe_gui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
HomePage: https://github.com/muziing/Py2exe-GUI
88
"""
99

10-
__version__ = "0.2.1"
10+
__version__ = "0.3.0"

0 commit comments

Comments
 (0)