Skip to content

Commit 4bff3c3

Browse files
committed
Added icon selection functionality to multiple compiler engines
1 parent 7378da1 commit 4bff3c3

9 files changed

Lines changed: 152 additions & 5 deletions

File tree

ENGINES/cx_freeze/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ def build_command(self, gui, file: str) -> list[str]:
8080
# Start with python -m cx_Freeze
8181
cmd = [python_path, "-m", "cx_Freeze"]
8282

83+
# Add options from UI
84+
# Onefile mode
85+
onefile = self._get_opt("onefile")
86+
if onefile and onefile.isChecked():
87+
cmd.append("--onefile")
88+
89+
# Windowed mode
90+
windowed = self._get_opt("windowed")
91+
if windowed and windowed.isChecked():
92+
cmd.append("--no-console")
93+
94+
# Output directory
95+
output_dir = self._get_input("output_dir")
96+
if output_dir and output_dir.text().strip():
97+
cmd.extend(["--build-exe", output_dir.text().strip()])
98+
99+
# Icon
100+
if hasattr(self, "_selected_icon") and self._selected_icon:
101+
cmd.extend(["--icon", self._selected_icon])
102+
83103
return cmd
84104

85105
except Exception as e:
@@ -175,6 +195,7 @@ def create_tab(self, gui):
175195
icon_layout = QHBoxLayout()
176196
self._cx_btn_select_icon = QPushButton("🎨 Choisir une icône (.ico)")
177197
self._cx_btn_select_icon.setObjectName("cx_btn_select_icon_dynamic")
198+
self._cx_btn_select_icon.clicked.connect(self.select_icon)
178199
icon_layout.addWidget(self._cx_btn_select_icon)
179200
icon_layout.addStretch()
180201
layout.addLayout(icon_layout)

ENGINES/nuitka/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def create_tab(self, gui):
249249
icon_layout = QHBoxLayout()
250250
self._btn_nuitka_icon = QPushButton("🎨 Choisir une icône (.ico) Nuitka")
251251
self._btn_nuitka_icon.setObjectName("btn_nuitka_icon_dynamic")
252+
self._btn_nuitka_icon.clicked.connect(self.select_icon)
252253
icon_layout.addWidget(self._btn_nuitka_icon)
253254
icon_layout.addStretch()
254255
layout.addLayout(icon_layout)
@@ -403,3 +404,22 @@ def add_data(self) -> None:
403404
self._gui.log.append(
404405
f"Dossier ajouté à Nuitka : {dir_path} => {dest}"
405406
)
407+
408+
def select_icon(self) -> None:
409+
"""Select an icon file for the executable."""
410+
try:
411+
from PySide6.QtWidgets import QFileDialog
412+
413+
file_path, _ = QFileDialog.getOpenFileName(
414+
self._gui,
415+
"Sélectionner une icône",
416+
"",
417+
"Fichiers icône (*.ico);;Tous les fichiers (*)"
418+
)
419+
if file_path:
420+
self._selected_icon = file_path
421+
if hasattr(self._gui, "log"):
422+
self._gui.log.append(f"Icône sélectionnée pour Nuitka : {file_path}")
423+
except Exception as e:
424+
if hasattr(self._gui, "log"):
425+
self._gui.log.append(f"❌ Erreur lors de la sélection de l'icône : {e}")

ENGINES/nuitka/languages/af.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"_meta": {
3+
"code": "af",
4+
"name": "Afrikaans"
5+
},
6+
"tab_label": "Nuitka",
7+
"mode_label": "Modus:",
8+
"onefile_checkbox": "Een lêer (--onefile)",
9+
"type_label": "Tipe:",
10+
"standalone_checkbox": "Selfstandig (--standalone)",
11+
"console_label": "Konsole:",
12+
"disable_console_checkbox": "Deaktiveer Windows konsole (--windows-disable-console)",
13+
"progress_label": "Vordering:",
14+
"show_progress_checkbox": "Wys vordering (--show-progress)",
15+
"add_data_button": "add_data",
16+
"output_placeholder": "Uitset gids (--output-dir)",
17+
"icon_button": "🎨 Kies ikoon (.ico) Nuitka"
18+
}

ENGINES/nuitka/languages/ko.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"_meta": {
3+
"code": "ko",
4+
"name": "한국어"
5+
},
6+
"tab_label": "Nuitka",
7+
"mode_label": "모드:",
8+
"onefile_checkbox": "단일 파일 (--onefile)",
9+
"type_label": "유형:",
10+
"standalone_checkbox": "독립 실행형 (--standalone)",
11+
"console_label": "콘솔:",
12+
"disable_console_checkbox": "Windows 콘솔 비활성화 (--windows-disable-console)",
13+
"progress_label": "진행률:",
14+
"show_progress_checkbox": "진행률 표시 (--show-progress)",
15+
"add_data_button": "add_data",
16+
"output_placeholder": "출력 디렉터리 (--output-dir)",
17+
"icon_button": "🎨 아이콘 선택 (.ico) Nuitka"
18+
}

ENGINES/nuitka/languages/ru.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"_meta": {
3+
"code": "ru",
4+
"name": "Русский"
5+
},
6+
"tab_label": "Nuitka",
7+
"mode_label": "Режим:",
8+
"onefile_checkbox": "Один файл (--onefile)",
9+
"type_label": "Тип:",
10+
"standalone_checkbox": "Автономный (--standalone)",
11+
"console_label": "Консоль:",
12+
"disable_console_checkbox": "Отключить консоль Windows (--windows-disable-console)",
13+
"progress_label": "Прогресс:",
14+
"show_progress_checkbox": "Показать прогресс (--show-progress)",
15+
"add_data_button": "add_data",
16+
"output_placeholder": "Выходной каталог (--output-dir)",
17+
"icon_button": "🎨 Выбрать иконку (.ico) Nuitka"
18+
}

ENGINES/pyinstaller/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,8 @@ def build_command(self, gui, file: str) -> list[str]:
118118
cmd.extend(["--distpath", output_dir.text().strip()])
119119

120120
# Icon
121-
if platform.system() == "Windows":
122-
# Try btn_select_icon callback for icon path
123-
btn_icon = self._get_btn("select_icon")
124-
if btn_icon and hasattr(self, "_selected_icon"):
125-
cmd.extend(["--icon", self._selected_icon])
121+
if hasattr(self, "_selected_icon") and self._selected_icon:
122+
cmd.extend(["--icon", self._selected_icon])
126123

127124
# Name
128125
name_input = self._get_input("output_name_input")
@@ -250,6 +247,7 @@ def create_tab(self, gui):
250247
icon_layout = QHBoxLayout()
251248
self._btn_select_icon = QPushButton("🎨 Choisir une icône (.ico)")
252249
self._btn_select_icon.setObjectName("btn_select_icon_dynamic")
250+
self._btn_select_icon.clicked.connect(self.select_icon)
253251
icon_layout.addWidget(self._btn_select_icon)
254252
icon_layout.addStretch()
255253
layout.addLayout(icon_layout)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"_meta": {
3+
"code": "af",
4+
"name": "Afrikaans"
5+
},
6+
"tab_label": "PyInstaller",
7+
"mode_label": "Modus:",
8+
"onefile_checkbox": "Een lêer",
9+
"windowed_checkbox": "Venster",
10+
"noconfirm_checkbox": "Geen bevestiging",
11+
"clean_checkbox": "Skoon",
12+
"noupx_checkbox": "Geen UPX",
13+
"main_only_checkbox": "Kompileer slegs main.py of app.py",
14+
"debug_checkbox": "Ontfoutmodus (--debug)",
15+
"add_data_button": "add_data",
16+
"output_placeholder": "Uitset gids (--distpath). Laat leeg vir ./dist",
17+
"icon_button": "🎨 Kies ikoon (.ico)"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"_meta": {
3+
"code": "it",
4+
"name": "Italiano"
5+
},
6+
"tab_label": "PyInstaller",
7+
"mode_label": "Modalità:",
8+
"onefile_checkbox": "File singolo",
9+
"windowed_checkbox": "Finestra",
10+
"noconfirm_checkbox": "Nessuna conferma",
11+
"clean_checkbox": "Pulizia",
12+
"noupx_checkbox": "Senza UPX",
13+
"main_only_checkbox": "Compila solo main.py o app.py",
14+
"debug_checkbox": "Modalità debug (--debug)",
15+
"add_data_button": "add_data",
16+
"output_placeholder": "Cartella di output (--distpath). Lascia vuoto per ./dist",
17+
"icon_button": "🎨 Scegli icona (.ico)"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"_meta": {
3+
"code": "ko",
4+
"name": "한국어"
5+
},
6+
"tab_label": "PyInstaller",
7+
"mode_label": "모드:",
8+
"onefile_checkbox": "단일 파일",
9+
"windowed_checkbox": "창 모드",
10+
"noconfirm_checkbox": "확인 없음",
11+
"clean_checkbox": "청소",
12+
"noupx_checkbox": "UPX 없음",
13+
"main_only_checkbox": "main.py 또는 app.py만 컴파일",
14+
"debug_checkbox": "디버그 모드 (--debug)",
15+
"add_data_button": "add_data",
16+
"output_placeholder": "출력 디렉터리 (--distpath). ./dist로 두려면 비워두세요",
17+
"icon_button": "🎨 아이콘 선택 (.ico)"
18+
}

0 commit comments

Comments
 (0)