|
16 | 16 | ) |
17 | 17 |
|
18 | 18 | from ..Constants.packaging_constants import PyinstallerArgs |
| 19 | +from ..Constants.platform_constants import PLATFORM |
19 | 20 | from .arguments_browser import ArgumentsBrowser |
20 | 21 | from .dialog_widgets import IconFileDlg, ScriptFileDlg |
21 | 22 |
|
@@ -52,14 +53,14 @@ def __init__(self, parent: QMainWindow) -> None: |
52 | 53 | self.fd_group = QButtonGroup() |
53 | 54 |
|
54 | 55 | # 应用图标(仅 Windows 与 macOS) |
55 | | - if self.parent().running_platform in ("Windows", "macOS"): |
| 56 | + if self.parent().running_platform in (PLATFORM.windows, PLATFORM.macos): |
56 | 57 | self.icon_path_label = QLabel() |
57 | 58 | self.icon_file_dlg = IconFileDlg() |
58 | 59 | self.icon_browse_btn = QPushButton() |
59 | 60 | self.icon_path_le = QLineEdit() |
60 | 61 |
|
61 | 62 | # 是否为stdio启用终端(仅 Windows 与 macOS) |
62 | | - if self.parent().running_platform in ("Windows", "macOS"): |
| 63 | + if self.parent().running_platform in (PLATFORM.windows, PLATFORM.macos): |
63 | 64 | self.console_checkbox = QCheckBox() |
64 | 65 |
|
65 | 66 | # 预览生成的PyInstaller打包指令 |
@@ -92,7 +93,7 @@ def setup_ui(self) -> None: |
92 | 93 | self.fd_group.addButton(self.one_dir_btn, 0) |
93 | 94 | self.fd_group.addButton(self.one_file_btn, 1) |
94 | 95 |
|
95 | | - if self.parent().running_platform in ("Windows", "macOS"): |
| 96 | + if self.parent().running_platform in (PLATFORM.windows, PLATFORM.macos): |
96 | 97 | self.icon_path_label.setText("应用图标:") |
97 | 98 | self.icon_path_le.setReadOnly(True) |
98 | 99 | self.icon_path_le.setPlaceholderText("图标文件路径") |
@@ -182,7 +183,7 @@ def run_packaging() -> None: |
182 | 183 | self.fd_group.idClicked.connect(one_fd_selected) # type: ignore |
183 | 184 | self.run_packaging_btn.clicked.connect(run_packaging) # type: ignore |
184 | 185 |
|
185 | | - if self.parent().running_platform in ("Windows", "macOS"): |
| 186 | + if self.parent().running_platform in (PLATFORM.windows, PLATFORM.macos): |
186 | 187 | self.icon_browse_btn.clicked.connect(self.icon_file_dlg.open) # type: ignore |
187 | 188 | self.icon_file_dlg.fileSelected.connect(icon_file_selected) # type: ignore |
188 | 189 | self.console_checkbox.toggled.connect(console_selected) # type: ignore |
@@ -289,7 +290,7 @@ def _set_layout(self) -> None: |
289 | 290 | main_layout.addLayout(fd_layout) |
290 | 291 | main_layout.addSpacing(10) |
291 | 292 |
|
292 | | - if self.parent().running_platform in ("Windows", "macOS"): |
| 293 | + if self.parent().running_platform in (PLATFORM.windows, PLATFORM.macos): |
293 | 294 | main_layout.addWidget(self.console_checkbox) |
294 | 295 | main_layout.addSpacing(10) |
295 | 296 |
|
|
0 commit comments