mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-11-09 14:02:14 +00:00
38 lines
1014 B
Python
38 lines
1014 B
Python
from PySide6.QtCore import Property, QObject, Signal
|
|
from PySide6.QtGui import QColor
|
|
|
|
from .shared import ThemeImpl
|
|
|
|
QML_IMPORT_NAME = "internal.ui.theme"
|
|
QML_IMPORT_MAJOR_VERSION = 1
|
|
QML_IMPORT_MINOR_VERSION = 0
|
|
|
|
|
|
class ThemeQmlExposer(QObject):
|
|
themeChanged = Signal()
|
|
|
|
def __init__(self, *, themeImpl: ThemeImpl, parent: QObject | None = None):
|
|
super().__init__(parent)
|
|
self._themeImpl = themeImpl
|
|
|
|
@property
|
|
def themeImpl(self) -> ThemeImpl:
|
|
return self._themeImpl
|
|
|
|
@themeImpl.setter
|
|
def themeImpl(self, themeImpl: ThemeImpl):
|
|
self._themeImpl = themeImpl
|
|
self.themeChanged.emit()
|
|
|
|
@Property(QColor, notify=themeChanged)
|
|
def primary(self):
|
|
return self._themeImpl.customPalette["primary"]
|
|
|
|
@Property(QColor, notify=themeChanged)
|
|
def success(self):
|
|
return self._themeImpl.customPalette["success"]
|
|
|
|
@Property(QColor, notify=themeChanged)
|
|
def error(self):
|
|
return self._themeImpl.customPalette["error"]
|