Skip to content

Commit 5c6ced3

Browse files
committed
engines: fiabiliser les tabs IDE et alleger la presentation
- ajoute un fallback de creation dynamique pour les tabs PyInstaller et Nuitka - maintient la compatibilite avec les attributs attendus par le compilateur - retire les labels 'Options ...' pour densifier les panneaux - conserve le comportement cx_Freeze sans titre superflu
1 parent 9d9b607 commit 5c6ced3

3 files changed

Lines changed: 167 additions & 16 deletions

File tree

ENGINES/cx_freeze/engine.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -740,13 +740,7 @@ def create_tab(self, gui):
740740
return None
741741
tab = QWidget()
742742
layout = QVBoxLayout(tab)
743-
# Title
744-
try:
745-
title = QLabel(gui.tr("Options cx_Freeze", "cx_Freeze Options"))
746-
layout.addWidget(title)
747-
self._cx_title = title
748-
except Exception:
749-
self._cx_title = None
743+
self._cx_title = None
750744
# Output dir row
751745
row = QHBoxLayout()
752746
out_edit = QLineEdit()
@@ -987,12 +981,6 @@ def g(key: str) -> Optional[str]:
987981
except Exception:
988982
return None
989983

990-
# Apply title text
991-
try:
992-
if getattr(self, "_cx_title", None):
993-
self._cx_title.setText(g("cx_freeze_title") or gui.tr("Options cx_Freeze", "cx_Freeze Options"))
994-
except Exception:
995-
pass
996984
# Output dir
997985
try:
998986
if getattr(self, "_output_dir_input", None):

ENGINES/nuitka/engine.py

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,86 @@ def create_tab(self, gui):
400400

401401
tab = getattr(gui, "tab_nuitka", None)
402402
if tab and isinstance(tab, QWidget):
403-
return tab, _tr("Nuitka", "Nuitka")
403+
try:
404+
return tab, gui.tr("Nuitka", "Nuitka")
405+
except Exception:
406+
return tab, "Nuitka"
404407
except Exception:
405408
pass
406-
return None
409+
def _t(fr: str, en: str) -> str:
410+
try:
411+
return gui.tr(fr, en)
412+
except Exception:
413+
return en
414+
# IDE-like fallback: build a minimal but functional tab dynamically.
415+
try:
416+
from PySide6.QtWidgets import (
417+
QCheckBox,
418+
QFileDialog,
419+
QHBoxLayout,
420+
QLabel,
421+
QLineEdit,
422+
QPushButton,
423+
QVBoxLayout,
424+
QWidget,
425+
)
426+
except Exception:
427+
return None
428+
429+
tab = QWidget()
430+
layout = QVBoxLayout(tab)
431+
432+
self._n_onefile = QCheckBox(_t("Onefile", "Onefile"))
433+
self._n_standalone = QCheckBox(_t("Standalone", "Standalone"))
434+
self._n_disable_console = QCheckBox(_t("Désactiver console (Windows)", "Disable console (Windows)"))
435+
self._n_show_progress = QCheckBox(_t("Afficher progression", "Show progress"))
436+
437+
try:
438+
self._n_standalone.setChecked(True)
439+
except Exception:
440+
pass
441+
442+
for cb in (
443+
self._n_onefile,
444+
self._n_standalone,
445+
self._n_disable_console,
446+
self._n_show_progress,
447+
):
448+
layout.addWidget(cb)
449+
450+
# Output directory
451+
row_dir = QHBoxLayout()
452+
lbl_dir = QLabel(_t("Dossier de sortie", "Output directory"))
453+
out_dir = QLineEdit()
454+
out_dir.setPlaceholderText(_t("Dossier build Nuitka", "Nuitka build directory"))
455+
btn_dir = QPushButton(_t("Parcourir...", "Browse..."))
456+
457+
def _browse_out():
458+
try:
459+
start_dir = out_dir.text().strip() or getattr(gui, "workspace_dir", "") or os.getcwd()
460+
selected = QFileDialog.getExistingDirectory(
461+
tab, _t("Choisir le dossier de sortie", "Choose output directory"), start_dir
462+
)
463+
if selected:
464+
out_dir.setText(selected)
465+
except Exception:
466+
pass
467+
468+
try:
469+
btn_dir.clicked.connect(_browse_out)
470+
except Exception:
471+
pass
472+
row_dir.addWidget(lbl_dir)
473+
row_dir.addWidget(out_dir)
474+
row_dir.addWidget(btn_dir)
475+
layout.addLayout(row_dir)
476+
477+
# Keep GUI attribute compatibility for command builder.
478+
gui.nuitka_onefile = self._n_onefile
479+
gui.nuitka_standalone = self._n_standalone
480+
gui.nuitka_disable_console = self._n_disable_console
481+
gui.nuitka_show_progress = self._n_show_progress
482+
gui.nuitka_output_dir = out_dir
483+
gui.tab_nuitka = tab
484+
485+
return tab, _t("Nuitka", "Nuitka")

ENGINES/pyinstaller/engine.py

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,88 @@ def create_tab(self, gui):
283283
return tab, gui.tr("PyInstaller", "PyInstaller")
284284
except Exception:
285285
pass
286-
return None
286+
# IDE-like fallback: build a minimal but functional tab dynamically.
287+
try:
288+
from PySide6.QtWidgets import (
289+
QCheckBox,
290+
QFileDialog,
291+
QHBoxLayout,
292+
QLabel,
293+
QLineEdit,
294+
QPushButton,
295+
QVBoxLayout,
296+
QWidget,
297+
)
298+
except Exception:
299+
return None
300+
301+
tab = QWidget()
302+
layout = QVBoxLayout(tab)
303+
304+
# Output name
305+
row_name = QHBoxLayout()
306+
lbl_name = QLabel(gui.tr("Nom de sortie", "Output name"))
307+
out_name = QLineEdit()
308+
out_name.setPlaceholderText(gui.tr("Nom de l'exécutable", "Executable name"))
309+
row_name.addWidget(lbl_name)
310+
row_name.addWidget(out_name)
311+
layout.addLayout(row_name)
312+
313+
# Output directory
314+
row_dir = QHBoxLayout()
315+
lbl_dir = QLabel(gui.tr("Dossier de sortie", "Output directory"))
316+
out_dir = QLineEdit()
317+
out_dir.setPlaceholderText(gui.tr("Dossier dist", "Dist directory"))
318+
btn_dir = QPushButton(gui.tr("Parcourir...", "Browse..."))
319+
320+
def _browse_out():
321+
try:
322+
start_dir = out_dir.text().strip() or getattr(gui, "workspace_dir", "") or os.getcwd()
323+
selected = QFileDialog.getExistingDirectory(
324+
tab, gui.tr("Choisir le dossier de sortie", "Choose output directory"), start_dir
325+
)
326+
if selected:
327+
out_dir.setText(selected)
328+
except Exception:
329+
pass
330+
331+
try:
332+
btn_dir.clicked.connect(_browse_out)
333+
except Exception:
334+
pass
335+
row_dir.addWidget(lbl_dir)
336+
row_dir.addWidget(out_dir)
337+
row_dir.addWidget(btn_dir)
338+
layout.addLayout(row_dir)
339+
340+
# Core options used by build_pyinstaller_command
341+
self._opt_onefile = QCheckBox(gui.tr("Onefile", "Onefile"))
342+
self._opt_windowed = QCheckBox(gui.tr("Sans console", "Windowed"))
343+
self._opt_noconfirm = QCheckBox(gui.tr("No confirm", "No confirm"))
344+
self._opt_clean = QCheckBox(gui.tr("Clean build", "Clean build"))
345+
self._opt_noupx = QCheckBox(gui.tr("No UPX", "No UPX"))
346+
self._opt_debug = QCheckBox(gui.tr("Debug", "Debug"))
347+
348+
for cb in (
349+
self._opt_onefile,
350+
self._opt_windowed,
351+
self._opt_noconfirm,
352+
self._opt_clean,
353+
self._opt_noupx,
354+
self._opt_debug,
355+
):
356+
layout.addWidget(cb)
357+
358+
# Store on GUI for compiler command builder compatibility.
359+
gui.output_name_input = out_name
360+
gui.output_dir_input = out_dir
361+
gui.opt_onefile = self._opt_onefile
362+
gui.opt_windowed = self._opt_windowed
363+
gui.opt_noconfirm = self._opt_noconfirm
364+
gui.opt_clean = self._opt_clean
365+
gui.opt_noupx = self._opt_noupx
366+
gui.opt_debug = self._opt_debug
367+
368+
# Keep backward-compatible tab reference.
369+
gui.tab_pyinstaller = tab
370+
return tab, gui.tr("PyInstaller", "PyInstaller")

0 commit comments

Comments
 (0)