from __future__ import annotations from functools import lru_cache from PySide6.QtGui import QIcon # Import QtSvg so packaged builds include the SVG icon support plugin. try: # pragma: no cover - packaging safeguard from PySide6 import QtSvg # noqa: F401 except Exception: # pragma: no cover - icon loading can still degrade safely QtSvg = None from pdfreaderlite.resources import resource_path @lru_cache(maxsize=128) def action_icon(name: str) -> QIcon: path = resource_path(f"resources/icons/actions/{name}.svg") if not path.exists(): return QIcon() icon = QIcon(path.as_posix()) icon.setIsMask(True) return icon