Files
Tagger/src/ui/utils.py

23 lines
505 B
Python
Raw Normal View History

2025-12-30 07:54:30 +01:00
"""
2026-01-24 07:50:19 +01:00
UI utility functions for Tagger GUI (PySide6).
2025-12-30 07:54:30 +01:00
"""
2026-01-24 07:50:19 +01:00
from pathlib import Path
from PySide6.QtGui import QIcon, QPixmap
2025-12-30 07:54:30 +01:00
2026-01-24 07:50:19 +01:00
def load_icon(path: str | Path, size: int = 16) -> QIcon:
2025-12-30 07:54:30 +01:00
"""
2026-01-24 07:50:19 +01:00
Load an icon from file and optionally resize.
2025-12-30 07:54:30 +01:00
Args:
path: Path to the image file
2026-01-24 07:50:19 +01:00
size: Icon size in pixels (default 16)
2025-12-30 07:54:30 +01:00
Returns:
2026-01-24 07:50:19 +01:00
QIcon object
2025-12-30 07:54:30 +01:00
"""
2026-01-24 07:50:19 +01:00
pixmap = QPixmap(str(path))
if not pixmap.isNull():
pixmap = pixmap.scaled(size, size)
return QIcon(pixmap)