Version 0.3.0

新功能:
- 初步实现用户浏览选择其他 Python 解释器环境功能;
- 可以根据路径名称规律简单推断 Python 环境类型;

修复与优化:
- 修复因类型错误导致不能正确处理 option_error 的问题,用户输入错误时能够得到正确的警告提示了;
- 大幅完善与优化 docstrings,使符合 Sphinx 风格;
- 添加各模块的 `__all__` 白名单入口,模块成员更清晰;
- 将部分控件的从属关系进行调整优化;
- 略微优化性能;
This commit is contained in:
muzing 2024-01-02 22:26:42 +08:00
parent 8e48c32216
commit f5b3793903
4 changed files with 42 additions and 11 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "py2exe-gui"
version = "0.2.1"
version = "0.3.0"
description = "GUI for PyInstaller, based on PySide6"
keywords = ["PyInstaller", "GUI", "PySide6"]
authors = ["muzing <muzi2001@foxmail.com>"]
@ -9,7 +9,7 @@ readme = ["README.md", "README_zh.md"]
repository = "https://github.com/muziing/Py2exe-GUI"
exclude = ["src/py2exe_gui/Resources/Icons", "src/py2exe_gui/Resources/Texts"]
classifiers = [
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS"

View File

@ -24,7 +24,7 @@ class AppConstant:
"""应用程序级的常量"""
NAME = "Py2exe-GUI"
VERSION = "0.2.1"
VERSION = "0.3.0"
AUTHORS = ["muzing <muzi2001@foxmail.com>"]
LICENSE = "GPL-3.0-or-later"
HOME_PAGE = APP_URLs["HOME_PAGE"]

View File

@ -4,9 +4,12 @@
"""此模块主要包含用于在界面上预览显示 PyInstaller 命令选项的 `ArgumentsBrowser` 类
"""
__all__ = ["get_line_continuation", "ArgumentsBrowser"]
from typing import Optional
from PySide6.QtWidgets import QTextBrowser, QWidget
from PySide6.QtGui import QContextMenuEvent
from PySide6.QtWidgets import QMenu, QTextBrowser, QWidget
from ..Constants import RUNTIME_INFO, Platform
@ -53,20 +56,48 @@ class ArgumentsBrowser(QTextBrowser):
super().__init__(parent)
# 右键菜单
self.context_menu = QMenu(self)
copy_action = self.context_menu.addAction("复制")
copy_action.triggered.connect(self._handle_copy_action)
export_action = self.context_menu.addAction("导出")
export_action.triggered.connect(self._handle_export_action)
def contextMenuEvent(self, event: QContextMenuEvent) -> None:
"""重写右键菜单事件
:param event: 事件
"""
self.context_menu.exec(event.globalPos())
def _handle_copy_action(self) -> None:
"""处理复制事件"""
# TODO 实现复制到系统剪切板
self.copy()
def _handle_export_action(self) -> None:
"""处理导出事件"""
# TODO 实现到处到 PowerShell/Bash 脚本
pass
def enrich_args_text(self, args_list: list[str]) -> None:
"""对参数进行一定高亮美化后显示
:param args_list: 参数列表
"""
enriched_arg_texts: list[str] = [
wrap_font_tag(args_list[0], color=colors[4])
] # 首个参数一定为待打包的 Python 脚本名
# 不间断换行(续行)符
line_continuation = get_line_continuation() + "<br>" + ("&nbsp;" * 4)
# 首个参数一定为待打包的 Python 脚本名
enriched_arg_texts: list[str] = [wrap_font_tag(args_list[0], color=colors[4])]
for arg in args_list[1:]:
if arg.startswith("--") or arg.startswith("-"):
enriched_arg_texts.append(
get_line_continuation() + "<br>" + "&nbsp;&nbsp;&nbsp;&nbsp;"
) # 添加换行,便于阅读与复制导出脚本
enriched_arg_texts.append(line_continuation) # 添加换行,便于阅读与复制导出脚本
enriched_arg_texts.append(wrap_font_tag(arg, color=colors[1]))
else:
enriched_arg_texts.append(arg)

View File

@ -7,4 +7,4 @@ designed to provide a complete yet easy-to-use GUI for PyInstaller.
HomePage: https://github.com/muziing/Py2exe-GUI
"""
__version__ = "0.2.1"
__version__ = "0.3.0"