1919)
2020
2121from ..Constants .packaging_constants import PyinstallerArgs
22- from ..Constants .platform_constants import PLATFORM , RUNTIME_PLATFORM
22+ from ..Constants .platform_constants import PLATFORM
23+ from ..Core import RUNTIME_INFO
2324from .arguments_browser import ArgumentsBrowser
2425from .dialog_widgets import IconFileDlg , ScriptFileDlg
2526
@@ -58,7 +59,7 @@ def __init__(self, parent: QMainWindow) -> None:
5859 self .fd_group = QButtonGroup ()
5960
6061 # 应用图标(仅 Windows 与 macOS)
61- if RUNTIME_PLATFORM in (PLATFORM .windows , PLATFORM .macos ):
62+ if RUNTIME_INFO . platform in (PLATFORM .windows , PLATFORM .macos ):
6263 self .icon_path_label = QLabel ()
6364 self .icon_file_dlg = IconFileDlg ()
6465 self .icon_browse_btn = QPushButton ()
@@ -67,7 +68,7 @@ def __init__(self, parent: QMainWindow) -> None:
6768 # TODO 重构不同平台功能判断,减少 if RUNTIME_PLATFORM in () 语句重复次数
6869
6970 # 是否为stdio启用终端(仅 Windows 与 macOS)
70- if RUNTIME_PLATFORM in (PLATFORM .windows , PLATFORM .macos ):
71+ if RUNTIME_INFO . platform in (PLATFORM .windows , PLATFORM .macos ):
7172 self .console_checkbox = QCheckBox ()
7273
7374 # 清理缓存与临时文件
@@ -103,7 +104,7 @@ def _setup_ui(self) -> None:
103104 self .fd_group .addButton (self .one_dir_btn , 0 )
104105 self .fd_group .addButton (self .one_file_btn , 1 )
105106
106- if RUNTIME_PLATFORM in (PLATFORM .windows , PLATFORM .macos ):
107+ if RUNTIME_INFO . platform in (PLATFORM .windows , PLATFORM .macos ):
107108 self .icon_path_label .setText ("应用图标:" )
108109 self .icon_path_le .setReadOnly (True )
109110 self .icon_path_le .setPlaceholderText ("图标文件路径" )
@@ -202,18 +203,18 @@ def run_packaging() -> None:
202203 self .parent ().packager .run_packaging_process ()
203204
204205 # 连接信号与槽
205- self .script_browse_btn .clicked .connect (self .script_file_dlg .open ) # type: ignore
206- self .script_file_dlg .fileSelected .connect (script_file_selected ) # type: ignore
207- self .project_name_le .editingFinished .connect (project_name_selected ) # type: ignore
208- self .fd_group .idClicked .connect (one_fd_selected ) # type: ignore
209- self .run_packaging_btn .clicked .connect (run_packaging ) # type: ignore
206+ self .script_browse_btn .clicked .connect (self .script_file_dlg .open )
207+ self .script_file_dlg .fileSelected .connect (script_file_selected )
208+ self .project_name_le .editingFinished .connect (project_name_selected )
209+ self .fd_group .idClicked .connect (one_fd_selected )
210+ self .run_packaging_btn .clicked .connect (run_packaging )
210211
211- if RUNTIME_PLATFORM in (PLATFORM .windows , PLATFORM .macos ):
212- self .icon_browse_btn .clicked .connect (self .icon_file_dlg .open ) # type: ignore
213- self .icon_file_dlg .fileSelected .connect (icon_file_selected ) # type: ignore
214- self .console_checkbox .toggled .connect (console_selected ) # type: ignore
212+ if RUNTIME_INFO . platform in (PLATFORM .windows , PLATFORM .macos ):
213+ self .icon_browse_btn .clicked .connect (self .icon_file_dlg .open )
214+ self .icon_file_dlg .fileSelected .connect (icon_file_selected )
215+ self .console_checkbox .toggled .connect (console_selected )
215216
216- self .clean_checkbox .toggled .connect (clean_selected ) # type: ignore
217+ self .clean_checkbox .toggled .connect (clean_selected )
217218
218219 def _set_layout (self ) -> None :
219220 """
@@ -243,7 +244,7 @@ def _set_layout(self) -> None:
243244 main_layout .addLayout (fd_layout )
244245 main_layout .addStretch (10 )
245246
246- if RUNTIME_PLATFORM in (PLATFORM .windows , PLATFORM .macos ):
247+ if RUNTIME_INFO . platform in (PLATFORM .windows , PLATFORM .macos ):
247248 main_layout .addWidget (self .console_checkbox )
248249 main_layout .addStretch (10 )
249250 icon_layout = QGridLayout ()
0 commit comments