Skip to content

Commit 7e123e2

Browse files
committed
Removed unused code and refactored add_data functionality in init_ui.py and ENGINES/* files
1 parent 4236364 commit 7e123e2

3 files changed

Lines changed: 104 additions & 109 deletions

File tree

Core/init_ui.py

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,6 @@ def init_ui(self):
304304
self.nuitka_show_progress = None
305305
self.nuitka_plugins = None # Champ supprimé de l'UI; plugins gérés automatiquement
306306
self.nuitka_output_dir = None
307-
self.nuitka_add_data = None
308-
self.nuitka_data_files = [] # Liste des tuples (source, dest)
309307
self.btn_nuitka_icon = None
310308
# Static checkbox widgets are None - options are now in dynamic tabs
311309
# Tooltips are handled by the engines themselves
@@ -316,8 +314,6 @@ def init_ui(self):
316314
self.progress = self.ui.findChild(QProgressBar, "progress")
317315
self.log = self.ui.findChild(QTextEdit, "log")
318316
# PyInstaller widgets (no longer static - now created dynamically by PyInstaller engine)
319-
self.pyinstaller_add_data = None
320-
self.pyinstaller_data = [] # Liste des tuples (source, dest)
321317
self.output_dir_input = None
322318
self.btn_browse_output_dir = None
323319
self.btn_export_config = self.ui.findChild(QPushButton, "btn_export_config")
@@ -442,111 +438,6 @@ def set_checked_safe(widget, checked):
442438
pass
443439

444440

445-
def add_pyinstaller_data(self):
446-
import os
447-
448-
from PySide6.QtCore import QDir
449-
from PySide6.QtWidgets import QFileDialog, QInputDialog
450-
451-
choix, ok = QInputDialog.getItem(
452-
self,
453-
"Type d'inclusion",
454-
"Inclure un fichier ou un dossier ?",
455-
["Fichier", "Dossier"],
456-
0,
457-
False,
458-
)
459-
if not ok:
460-
return
461-
if choix == "Fichier":
462-
file_path, _ = QFileDialog.getOpenFileName(
463-
self, "Sélectionner un fichier à inclure avec PyInstaller"
464-
)
465-
if file_path:
466-
dest, ok = QInputDialog.getText(
467-
self,
468-
"Chemin de destination",
469-
"Chemin de destination dans l'exécutable :",
470-
text=os.path.basename(file_path),
471-
)
472-
if ok and dest:
473-
self.pyinstaller_data.append((file_path, dest))
474-
if hasattr(self, "log"):
475-
self.log.append(
476-
f"Fichier ajouté à PyInstaller : {file_path} => {dest}"
477-
)
478-
elif choix == "Dossier":
479-
dir_path = QFileDialog.getExistingDirectory(
480-
self, "Sélectionner un dossier à inclure avec PyInstaller", QDir.homePath()
481-
)
482-
if dir_path:
483-
dest, ok = QInputDialog.getText(
484-
self,
485-
"Chemin de destination",
486-
"Chemin de destination dans l'exécutable :",
487-
text=os.path.basename(dir_path),
488-
)
489-
if ok and dest:
490-
self.pyinstaller_data.append((dir_path, dest))
491-
if hasattr(self, "log"):
492-
self.log.append(
493-
f"Dossier ajouté à PyInstaller : {dir_path} => {dest}"
494-
)
495-
496-
497-
def add_nuitka_data_file(self):
498-
import os
499-
500-
from PySide6.QtCore import QDir
501-
from PySide6.QtWidgets import QFileDialog, QInputDialog
502-
503-
# Demander à l'utilisateur s'il veut ajouter un fichier ou un dossier
504-
choix, ok = QInputDialog.getItem(
505-
self,
506-
"Type d'inclusion",
507-
"Inclure un fichier ou un dossier ?",
508-
["Fichier", "Dossier"],
509-
0,
510-
False,
511-
)
512-
if not ok:
513-
return
514-
if not hasattr(self, "nuitka_data_files"):
515-
self.nuitka_data_files = []
516-
if not hasattr(self, "nuitka_data_dirs"):
517-
self.nuitka_data_dirs = []
518-
if choix == "Fichier":
519-
file_path, _ = QFileDialog.getOpenFileName(
520-
self, "Sélectionner un fichier à inclure avec Nuitka"
521-
)
522-
if file_path:
523-
dest, ok = QInputDialog.getText(
524-
self,
525-
"Chemin de destination",
526-
"Chemin de destination dans l'exécutable :",
527-
text=os.path.basename(file_path),
528-
)
529-
if ok and dest:
530-
self.nuitka_data_files.append((file_path, dest))
531-
if hasattr(self, "log"):
532-
self.log.append(f"Fichier ajouté à Nuitka : {file_path} => {dest}")
533-
elif choix == "Dossier":
534-
dir_path = QFileDialog.getExistingDirectory(
535-
self, "Sélectionner un dossier à inclure avec Nuitka", QDir.homePath()
536-
)
537-
if dir_path:
538-
dest, ok = QInputDialog.getText(
539-
self,
540-
"Chemin de destination",
541-
"Chemin de destination dans l'exécutable :",
542-
text=os.path.basename(dir_path),
543-
)
544-
if ok and dest:
545-
self.nuitka_data_dirs.append((dir_path, dest))
546-
if hasattr(self, "log"):
547-
self.log.append(f"Dossier ajouté à Nuitka : {dir_path} => {dest}")
548-
549-
550441
def show_language_dialog(self):
551442
from PySide6.QtWidgets import QInputDialog
552443

ENGINES/nuitka/__init__.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
import sys
2828
from typing import Optional
2929

30+
from PySide6.QtCore import QDir
31+
from PySide6.QtWidgets import QFileDialog, QInputDialog
32+
3033
from engine_sdk.base import CompilerEngine
3134
from engine_sdk import engine_register
3235

@@ -228,6 +231,7 @@ def create_tab(self, gui):
228231
# Add data button
229232
self._nuitka_add_data = QPushButton("add_data")
230233
self._nuitka_add_data.setObjectName("nuitka_add_data_dynamic")
234+
self._nuitka_add_data.clicked.connect(self.add_data)
231235
layout.addWidget(self._nuitka_add_data)
232236

233237
# Output directory
@@ -303,3 +307,50 @@ def apply_i18n(self, gui, tr: dict) -> None:
303307
"""Apply internationalization translations to the engine UI."""
304308
pass
305309

310+
def add_data(self) -> None:
311+
"""Add data files or directories to be included with Nuitka."""
312+
choix, ok = QInputDialog.getItem(
313+
self._gui,
314+
"Type d'inclusion",
315+
"Inclure un fichier ou un dossier ?",
316+
["Fichier", "Dossier"],
317+
0,
318+
False,
319+
)
320+
if not ok:
321+
return
322+
if not hasattr(self, "_data_files"):
323+
self._data_files = []
324+
if not hasattr(self, "_data_dirs"):
325+
self._data_dirs = []
326+
if choix == "Fichier":
327+
file_path, _ = QFileDialog.getOpenFileName(
328+
self._gui, "Sélectionner un fichier à inclure avec Nuitka"
329+
)
330+
if file_path:
331+
dest, ok = QInputDialog.getText(
332+
self._gui,
333+
"Chemin de destination",
334+
"Chemin de destination dans l'exécutable :",
335+
text=os.path.basename(file_path),
336+
)
337+
if ok and dest:
338+
self._data_files.append((file_path, dest))
339+
if hasattr(self._gui, "log"):
340+
self._gui.log.append(f"Fichier ajouté à Nuitka : {file_path} => {dest}")
341+
elif choix == "Dossier":
342+
dir_path = QFileDialog.getExistingDirectory(
343+
self._gui, "Sélectionner un dossier à inclure avec Nuitka", QDir.homePath()
344+
)
345+
if dir_path:
346+
dest, ok = QInputDialog.getText(
347+
self._gui,
348+
"Chemin de destination",
349+
"Chemin de destination dans l'exécutable :",
350+
text=os.path.basename(dir_path),
351+
)
352+
if ok and dest:
353+
self._data_dirs.append((dir_path, dest))
354+
if hasattr(self._gui, "log"):
355+
self._gui.log.append(f"Dossier ajouté à Nuitka : {dir_path} => {dest}")
356+

ENGINES/pyinstaller/__init__.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import sys
2929
from typing import Optional
3030

31+
from PySide6.QtCore import QDir
32+
from PySide6.QtWidgets import QFileDialog, QInputDialog
33+
3134
from engine_sdk.base import CompilerEngine
3235
from engine_sdk import engine_register
3336

@@ -267,6 +270,7 @@ def create_tab(self, gui):
267270
# Add data button
268271
self._pyinstaller_add_data = QPushButton("add_data")
269272
self._pyinstaller_add_data.setObjectName("pyinstaller_add_data_dynamic")
273+
self._pyinstaller_add_data.clicked.connect(self.add_data)
270274
layout.addWidget(self._pyinstaller_add_data)
271275

272276
# Output directory
@@ -328,3 +332,52 @@ def apply_i18n(self, gui, tr: dict) -> None:
328332
"""Apply internationalization translations to the engine UI."""
329333
pass
330334

335+
def add_data(self) -> None:
336+
"""Add data files or directories to be included with PyInstaller."""
337+
choix, ok = QInputDialog.getItem(
338+
self._gui,
339+
"Type d'inclusion",
340+
"Inclure un fichier ou un dossier ?",
341+
["Fichier", "Dossier"],
342+
0,
343+
False,
344+
)
345+
if not ok:
346+
return
347+
if not hasattr(self, "_data_files"):
348+
self._data_files = []
349+
if choix == "Fichier":
350+
file_path, _ = QFileDialog.getOpenFileName(
351+
self._gui, "Sélectionner un fichier à inclure avec PyInstaller"
352+
)
353+
if file_path:
354+
dest, ok = QInputDialog.getText(
355+
self._gui,
356+
"Chemin de destination",
357+
"Chemin de destination dans l'exécutable :",
358+
text=os.path.basename(file_path),
359+
)
360+
if ok and dest:
361+
self._data_files.append((file_path, dest))
362+
if hasattr(self._gui, "log"):
363+
self._gui.log.append(
364+
f"Fichier ajouté à PyInstaller : {file_path} => {dest}"
365+
)
366+
elif choix == "Dossier":
367+
dir_path = QFileDialog.getExistingDirectory(
368+
self._gui, "Sélectionner un dossier à inclure avec PyInstaller", QDir.homePath()
369+
)
370+
if dir_path:
371+
dest, ok = QInputDialog.getText(
372+
self._gui,
373+
"Chemin de destination",
374+
"Chemin de destination dans l'exécutable :",
375+
text=os.path.basename(dir_path),
376+
)
377+
if ok and dest:
378+
self._data_files.append((dir_path, dest))
379+
if hasattr(self._gui, "log"):
380+
self._gui.log.append(
381+
f"Dossier ajouté à PyInstaller : {dir_path} => {dest}"
382+
)
383+

0 commit comments

Comments
 (0)