Skip to content

Commit 489335d

Browse files
committed
Added GUI improvements and features
1 parent 2ef4415 commit 489335d

6 files changed

Lines changed: 630 additions & 180 deletions

File tree

Core/Gui.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,27 @@ def remove_selected_file(self):
250250
"""Supprime les fichiers sélectionnés."""
251251
WorkspaceAdvancedManipulation.remove_selected_file(self)
252252

253+
def apply_file_filter(self, text: Optional[str] = None) -> None:
254+
"""Filtre la liste des fichiers affichés selon un texte."""
255+
try:
256+
if text is None:
257+
try:
258+
if getattr(self, "file_filter_input", None):
259+
text = self.file_filter_input.text()
260+
except Exception:
261+
text = ""
262+
needle = (text or "").strip().lower()
263+
if not getattr(self, "file_list", None):
264+
return
265+
for i in range(self.file_list.count()):
266+
item = self.file_list.item(i)
267+
if item is None:
268+
continue
269+
hay = item.text().lower()
270+
item.setHidden(bool(needle) and needle not in hay)
271+
except Exception:
272+
pass
273+
253274
# =========================================================================
254275
# COMPILATION (délégation à Compiler)
255276
# =========================================================================

Core/UiConnection.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ def init_ui(self):
202202
self.venv_button = self.ui.findChild(QPushButton, "venv_button")
203203
self.venv_label = self.ui.findChild(QLabel, "venv_label")
204204
self.label_folder = self.ui.findChild(QLabel, "label_folder")
205+
self.label_workspace_status = self.ui.findChild(QLabel, "label_workspace_status")
205206
self.label_workspace_section = self.ui.findChild(QLabel, "label_workspace_section")
206207
self.label_files_section = self.ui.findChild(QLabel, "label_files_section")
207208
self.label_logs_section = self.ui.findChild(QLabel, "label_logs_section")
208209
self.file_list = self.ui.findChild(QListWidget, "file_list")
210+
self.file_filter_input = self.ui.findChild(QLineEdit, "file_filter_input")
209211
# Afficher le logo dans la sidebar (chemin absolu depuis le dossier projet)
210212
from PySide6.QtGui import QPixmap
211213
from PySide6.QtWidgets import QApplication
@@ -262,6 +264,21 @@ def init_ui(self):
262264
self.compile_btn = self.ui.findChild(QPushButton, "compile_btn")
263265
self.cancel_btn = self.ui.findChild(QPushButton, "cancel_btn")
264266
self.btn_help = self.ui.findChild(QPushButton, "btn_help")
267+
268+
# Statut workspace dans l'en-tête
269+
if self.label_workspace_status:
270+
try:
271+
ws = getattr(self, "workspace_dir", None)
272+
if ws:
273+
self.label_workspace_status.setText(
274+
self.tr(f"Workspace : {ws}", f"Workspace: {ws}")
275+
)
276+
else:
277+
self.label_workspace_status.setText(
278+
self.tr("Workspace : Aucun", "Workspace: None")
279+
)
280+
except Exception:
281+
pass
265282
self.btn_suggest_deps = self.ui.findChild(QPushButton, "btn_suggest_deps")
266283
self.btn_bc_loader = self.ui.findChild(QPushButton, "btn_bc_loader")
267284
self.btn_acasl_loader = self.ui.findChild(QPushButton, "btn_acasl_loader")
@@ -307,6 +324,13 @@ def init_ui(self):
307324
self.compile_btn.clicked.connect(self.compile_all)
308325
self.cancel_btn.clicked.connect(self.cancel_all_compilations)
309326

327+
# Filtre de fichiers
328+
if self.file_filter_input:
329+
try:
330+
self.file_filter_input.textChanged.connect(self.apply_file_filter)
331+
except Exception:
332+
pass
333+
310334
from bcasl import open_bc_loader_dialog
311335

312336
self.btn_bc_loader.clicked.connect(lambda: open_bc_loader_dialog(self))

Core/WorkSpaceManager/SetupWorkspace.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ def apply_workspace_selection(
168168
f"Dossier sélectionné : {folder}", f"Selected folder: {folder}"
169169
)
170170
)
171+
if hasattr(gui_instance, "label_workspace_status"):
172+
try:
173+
gui_instance.label_workspace_status.setText(
174+
gui_instance.tr(
175+
f"Workspace : {folder}", f"Workspace: {folder}"
176+
)
177+
)
178+
except Exception:
179+
pass
171180

172181
gui_instance.python_files.clear()
173182
if hasattr(gui_instance, "file_list"):
@@ -176,6 +185,12 @@ def apply_workspace_selection(
176185
SetupWorkspace.add_py_files_from_folder(gui_instance, folder)
177186
gui_instance.selected_files.clear()
178187

188+
try:
189+
if hasattr(gui_instance, "apply_file_filter"):
190+
gui_instance.apply_file_filter()
191+
except Exception:
192+
pass
193+
179194
if hasattr(gui_instance, "update_command_preview"):
180195
gui_instance.update_command_preview()
181196

@@ -278,6 +293,12 @@ def add_py_files_from_folder(gui_instance, folder: str) -> int:
278293
f"⏩ Exclusion applied: {excluded_count} file(s) excluded according to ARK_Main_Config.yml",
279294
)
280295

296+
try:
297+
if hasattr(gui_instance, "apply_file_filter"):
298+
gui_instance.apply_file_filter()
299+
except Exception:
300+
pass
301+
281302
return count
282303

283304
@staticmethod

Core/WorkSpaceManager/WorkspaceAdvancedManipulation.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ def select_files_manually(gui_instance):
8989
)
9090
if hasattr(gui_instance, "update_command_preview"):
9191
gui_instance.update_command_preview()
92+
try:
93+
if hasattr(gui_instance, "apply_file_filter"):
94+
gui_instance.apply_file_filter()
95+
except Exception:
96+
pass
9297

9398
@staticmethod
9499
def remove_selected_file(gui_instance):
@@ -196,6 +201,11 @@ def handle_drop_event(gui_instance, event: QDropEvent):
196201
f"⏩ Exclusion appliquée : {excluded} fichier(s) ignoré(s) (ARK_Main_Config.yml).",
197202
f"⏩ Exclusion applied: {excluded} file(s) ignored (ARK_Main_Config.yml).",
198203
)
204+
try:
205+
if hasattr(gui_instance, "apply_file_filter"):
206+
gui_instance.apply_file_filter()
207+
except Exception:
208+
pass
199209

200210
if hasattr(gui_instance, "update_command_preview"):
201211
gui_instance.update_command_preview()
@@ -254,6 +264,21 @@ def clear_workspace(gui_instance, keep_dir: bool = True) -> bool:
254264
"Dossier sélectionné : (aucun)", "Selected folder: (none)"
255265
)
256266
)
267+
if hasattr(gui_instance, "label_workspace_status"):
268+
try:
269+
if keep_dir and workspace_dir:
270+
gui_instance.label_workspace_status.setText(
271+
gui_instance.tr(
272+
f"Workspace : {workspace_dir}",
273+
f"Workspace: {workspace_dir}",
274+
)
275+
)
276+
else:
277+
gui_instance.label_workspace_status.setText(
278+
gui_instance.tr("Workspace : Aucun", "Workspace: None")
279+
)
280+
except Exception:
281+
pass
257282

258283
gui_instance.workspace_dir = None if not keep_dir else workspace_dir
259284

0 commit comments

Comments
 (0)