refactor: Centralize resource path management

Create a new `settings.py` file to define and manage global application paths.

Modify UI components (`split_view_widget.py`, `view_settings_dialog.py`) to use the centralized `ICONS_DIR` path constant instead of hardcoded relative paths for icons. This improves maintainability and makes the application independent of the working directory.
This commit is contained in:
2025-10-14 08:33:08 +02:00
parent bbdb7d3459
commit d62b367b47
3 changed files with 44 additions and 31 deletions

View File

@@ -2,6 +2,8 @@ from PySide6.QtWidgets import QDialog, QHBoxLayout ,QVBoxLayout, QPushButton, QG
from PySide6.QtGui import QIcon
from PySide6.QtCore import Qt, QSize, Signal
from settings import ICONS_DIR
ISO_ARR = ["AUTO","100", "200", "400", "800", "1600", "3200"]
SPEED_ARR = ["30", "25", "20", "15", "13", "10.3", "8", "6.3", "5", "4", "3.2", "2.5", "2", "1.6", "1.3", "1", "0.8", "0.6", "0.5", "0.4", "0.3", "1/4", "1/5", "1/6", "1/8", "1/10", "1/13", "1/15", "1/20", "1/25", "1/30", "1/40", "1/50", "1/60", "1/80", "1/100", "1/125", "1/160", "1/200", "1/250", "1/320", "1/400", "1/500", "1/640", "1/800", "1/1000", "1/1250", "1/1600", "1/2000", "1/2500", "1/3200", "1/4000"]
@@ -19,13 +21,13 @@ class LabeledSpinSelector(QWidget):
self.title_label = QLabel(title)
decrement_button = QToolButton()
decrement_button.setIcon(QIcon("ui/icons/arrow-left-335-svgrepo-com.svg"))
decrement_button.setIcon(QIcon(str(ICONS_DIR / "arrow-left-335-svgrepo-com.svg")))
decrement_button.setFixedSize(button_size, button_size)
decrement_button.setIconSize(QSize(icon_size, icon_size))
decrement_button.clicked.connect(self._decrement)
increment_button = QToolButton()
increment_button.setIcon(QIcon("ui/icons/arrow-right-336-svgrepo-com.svg"))
increment_button.setIcon(QIcon(str(ICONS_DIR / "arrow-right-336-svgrepo-com.svg")))
increment_button.setFixedSize(button_size, button_size)
increment_button.setIconSize(QSize(icon_size, icon_size))
increment_button.clicked.connect(self._increment)