resource_provider.py 490 B

1234567891011121314151617181920
  1. from pathlib import Path
  2. from PySide6.QtGui import QIcon
  3. class GooeyResources:
  4. def __init__(self):
  5. self._icons = {}
  6. self._ressource_path = Path(__file__).resolve().parent / 'resources'
  7. def get_icon(self, name):
  8. icon = self._icons.get(name)
  9. if icon is None:
  10. icon = QIcon(str(
  11. self._ressource_path / 'icons' / f'{name}.svg'))
  12. self._icons[name] = icon
  13. return icon
  14. gooey_resources = GooeyResources()