Skip to content

Commit 36e093c

Browse files
committed
Optimize codes
微调代码与注释; 使通过mypy检查;
1 parent 4f43837 commit 36e093c

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

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)