Skip to content

Commit e2a7bec

Browse files
committed
UI: ajout d'icônes thémées dans l'éditeur de configuration avancé
1 parent 989b46a commit e2a7bec

1 file changed

Lines changed: 31 additions & 9 deletions

File tree

Ui/Gui/Dialogs/AdvancedConfigEditor.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from pathlib import Path
2424
from typing import Any
2525

26-
from PySide6.QtCore import Qt
26+
from PySide6.QtCore import Qt, QSize
2727
from PySide6.QtGui import QFont
2828
from PySide6.QtWidgets import (
2929
QCheckBox,
@@ -51,6 +51,20 @@
5151
from Core.engine.registry import available_engines
5252

5353

54+
def _apply_themed_icon(widget: QPushButton, icon_name: str, size: int = 16) -> None:
55+
"""Applique une icône SVG thémée au widget."""
56+
try:
57+
from Ui.Gui.UiConnection import themed_svg_icon
58+
# icons/ is at project root, which is 4 levels up from this file
59+
icon_path = str(Path(__file__).parent.parent.parent.parent / "icons" / icon_name)
60+
icon = themed_svg_icon(icon_path, size=size)
61+
if icon:
62+
widget.setIcon(icon)
63+
widget.setIconSize(QSize(size, size))
64+
except Exception:
65+
pass
66+
67+
5468
class AdvancedConfigEditor(QDialog):
5569
"""Structured editor for ark.yml configuration."""
5670

@@ -91,8 +105,9 @@ def __init__(self, gui):
91105
self.edit_name = QLineEdit()
92106
self.edit_version = QLineEdit()
93107
self.edit_entry = QLineEdit()
94-
btn_browse_entry = QPushButton("...")
95-
btn_browse_entry.setFixedWidth(30)
108+
btn_browse_entry = QPushButton()
109+
_apply_themed_icon(btn_browse_entry, "play.svg")
110+
btn_browse_entry.setFixedWidth(35)
96111
btn_browse_entry.clicked.connect(self._browse_entry)
97112

98113
row_entry = QHBoxLayout()
@@ -111,16 +126,18 @@ def __init__(self, gui):
111126
self.combo_engine.addItems(available_engines())
112127

113128
self.edit_output = QLineEdit()
114-
btn_browse_output = QPushButton("...")
115-
btn_browse_output.setFixedWidth(30)
129+
btn_browse_output = QPushButton()
130+
_apply_themed_icon(btn_browse_output, "folder.svg")
131+
btn_browse_output.setFixedWidth(35)
116132
btn_browse_output.clicked.connect(self._browse_output)
117133
row_output = QHBoxLayout()
118134
row_output.addWidget(self.edit_output)
119135
row_output.addWidget(btn_browse_output)
120136

121137
self.edit_icon = QLineEdit()
122-
btn_browse_icon = QPushButton("...")
123-
btn_browse_icon.setFixedWidth(30)
138+
btn_browse_icon = QPushButton()
139+
_apply_themed_icon(btn_browse_icon, "image.svg")
140+
btn_browse_icon.setFixedWidth(35)
124141
btn_browse_icon.clicked.connect(self._browse_icon)
125142
row_icon = QHBoxLayout()
126143
row_icon.addWidget(self.edit_icon)
@@ -147,9 +164,12 @@ def __init__(self, gui):
147164
lay_data.addWidget(self.table_data)
148165

149166
row_btns_data = QHBoxLayout()
150-
btn_add_file = QPushButton(self.gui.tr("📄 Fichier", "Add File"))
151-
btn_add_dir = QPushButton(self.gui.tr("📁 Dossier", "Add Dir"))
167+
btn_add_file = QPushButton(self.gui.tr("Fichier", "File"))
168+
_apply_themed_icon(btn_add_file, "file-plus.svg")
169+
btn_add_dir = QPushButton(self.gui.tr("Dossier", "Dir"))
170+
_apply_themed_icon(btn_add_dir, "folder-plus.svg")
152171
btn_del_data = QPushButton(self.gui.tr("Supprimer", "Remove"))
172+
_apply_themed_icon(btn_del_data, "trash-2.svg")
153173

154174
btn_add_file.clicked.connect(self._on_add_file_data)
155175
btn_add_dir.clicked.connect(self._on_add_dir_data)
@@ -190,8 +210,10 @@ def __init__(self, gui):
190210
btn_row = QHBoxLayout()
191211
btn_row.addStretch()
192212
btn_cancel = QPushButton(self.gui.tr("Annuler", "Cancel"))
213+
_apply_themed_icon(btn_cancel, "x.svg")
193214
btn_cancel.clicked.connect(self.reject)
194215
btn_save = QPushButton(self.gui.tr("Enregistrer", "Save"))
216+
_apply_themed_icon(btn_save, "save.svg")
195217
btn_save.clicked.connect(self._on_save)
196218
btn_save.setDefault(True)
197219
btn_row.addWidget(btn_cancel)

0 commit comments

Comments
 (0)