Skip to content

Commit e0a3698

Browse files
committed
Merge branch 'dev'
2 parents 7bec679 + 36e093c commit e0a3698

11 files changed

Lines changed: 421 additions & 96 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ authors = ["muzing <muzi2001@foxmail.com>"]
77
license = "GPL-3.0-or-later"
88
readme = "README.md"
99
repository = "https://github.com/muziing/Py2exe-GUI"
10-
include = ["docs/source/images"]
10+
exclude = ["src/py2exe_gui/Resources"]
11+
include = ["src/py2exe_gui/Resources/compiled_resources.py"]
1112

1213
[tool.poetry.dependencies]
1314
python = ">=3.7,<3.11"
@@ -17,15 +18,16 @@ PySide6 = "~6.2.0" # latest LTS version
1718
"Bug Tracker" = "https://github.com/muziing/Py2exe-GUI/issues"
1819

1920
[tool.poetry.group.dev.dependencies]
20-
# Sphinx = "^5.2.0"
21+
# Sphinx = "^5.3.0"
2122
black = "^22.10.0"
2223
isort = "^5.10.0"
2324
mypy = "^0.991"
2425
pyinstaller = "^5.6"
2526

2627
[tool.black]
2728
line-length = 88
28-
target-version = ['py310']
29+
target-version = ["py310"]
30+
extend-exclude = "compiled_resources.py"
2931

3032
[tool.isort]
3133
profile = "black"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from .app_constants import *
22
from .packaging_constants import *
3-
# from .type_constants import *
3+
from .platform_constants import *
4+
from .type_constants import *
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import sys
2+
3+
4+
class PLATFORM:
5+
"""
6+
运行平台相关的常量 \n
7+
"""
8+
9+
windows = "Windows"
10+
linux = "Linux"
11+
macos = "macOS"
12+
others = "others"
13+
14+
15+
def get_platform() -> str:
16+
"""
17+
辅助函数,用于获取当前运行的平台 \n
18+
:return: platform
19+
"""
20+
21+
if sys.platform.startswith("win32"):
22+
return PLATFORM.windows
23+
elif sys.platform.startswith("linux"):
24+
return PLATFORM.linux
25+
elif sys.platform.startswith("darwin"):
26+
return PLATFORM.macos
27+
else:
28+
return PLATFORM.others

src/py2exe_gui/Core/packaging.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
from PySide6 import QtCore
44

5-
from ..Constants.packaging_constants import *
5+
from ..Constants.packaging_constants import PyinstallerArgs, pyinstaller_args_list
66
from .subprocess_tool import SubProcessTool
77

88

99
class Packaging(QtCore.QObject):
1010
"""
11-
执行打包的类
11+
执行打包的类 \n
1212
"""
1313

1414
# 自定义信号
@@ -33,9 +33,9 @@ def set_pyinstaller_args(self, arg: tuple[str, str]) -> None:
3333
"""
3434

3535
arg_key, arg_value = arg
36-
# if arg_key in pyinstaller_args_list:
37-
self.args_dict[arg_key] = arg_value
38-
self._add_pyinstaller_args()
36+
if arg_key in pyinstaller_args_list:
37+
self.args_dict[arg_key] = arg_value
38+
self._add_pyinstaller_args()
3939

4040
def _add_pyinstaller_args(self) -> None:
4141
"""
@@ -66,6 +66,5 @@ def run_packaging_process(self) -> None:
6666
使用给定的参数启动打包子进程 \n
6767
"""
6868

69-
# self.subprocess.output.connect(lambda val: print(val)) # 测试用
7069
self.subprocess.set_arguments(self._args)
7170
self.subprocess.start_process()

src/py2exe_gui/Core/packaging_task.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class PackagingTask(QtCore.QObject):
1010
"""
11-
打包任务类,存储每个打包任务的详细信息
11+
打包任务类,存储每个打包任务的详细信息 \n
1212
"""
1313

1414
# 自定义信号
@@ -26,7 +26,8 @@ def __init__(self, parent: Optional[QtCore.QObject] = None) -> None:
2626
self.script_path: Optional[Path] = None
2727
self.icon_path: Optional[Path] = None
2828
self.out_name: Optional[str] = None
29-
# TODO 在实例属性中保存该次打包的所有选项详情
29+
self.FD: Optional[bool] = None
30+
self.console: Optional[str] = None
3031

3132
def handle_option(self, option: tuple[str, str]):
3233
"""
@@ -48,7 +49,6 @@ def handle_option(self, option: tuple[str, str]):
4849
else:
4950
self.ready_to_pack.emit(False)
5051
self.option_error.emit(arg_key)
51-
# self.option_error.emit(arg_key) # 测试用!
5252

5353
elif arg_key == "icon_path":
5454
icon_path = Path(arg_value)
@@ -57,7 +57,6 @@ def handle_option(self, option: tuple[str, str]):
5757
self.option_set.emit(option)
5858
else:
5959
self.option_error.emit(arg_key)
60-
# self.option_error.emit(arg_key) # 测试用!
6160

6261
elif arg_key == "out_name":
6362
self.out_name = arg_value
@@ -66,10 +65,9 @@ def handle_option(self, option: tuple[str, str]):
6665
else:
6766
self.option_set.emit(option)
6867

69-
def write_to_file(self):
68+
def write_to_spec(self):
7069
"""
71-
将打包任务保存至文件
70+
将打包任务保存至spec文件 \n
7271
"""
7372

74-
# TODO 实现将打包任务信息保存至文件的功能
7573
pass

0 commit comments

Comments
 (0)