-
Notifications
You must be signed in to change notification settings - Fork 0
theme
Mihaly Konda edited this page Jul 9, 2025
·
2 revisions
version: v1.1.7
A module for setting a pre-defined theme to Qt objects.
Singleton object of the type _WidgetTheme, containing the types defined in the source JSON file.
def get_theme_types(fetch_data: bool = False) -> list[str | ThemeParameters]Returns the available themes.
Parameters:
- fetch_data: A flag requesting the ThemeParameters objects themselves. The default is False.
Dataclass for storing the palette parameter values to a given theme (to LIGHT, by default).
Parameters:
-
src_file: Path to the source file containing theme data.
def __post_init__(self) -> NoneDefines the default colours.
def write_json(self, destination: str) -> NoneWrites the content to a JSON file.
Parameters:
- destination: Path where the file should be written to.
A class for Enum-like access to themes.
def __init__(self) -> NoneInitializer for the class.
def __getattr__(self, name: str) -> ThemeParametersHandles an attribute access request. (It expects that at least one theme file exists!)
Parameters:
- name: The name of the requested theme.
Returns: A stored set of parameters of a theme.
def load_dict(self) -> NoneLoads the content of theme JSONs into the internal dictionary.
def set_widget_theme(widget: QWidgetT, theme: ThemeParameters = None) -> NoneSets a QWidget's palette to values defined by the theme.
Parameters:
- widget: A widget whose palette is to be set to the requested theme.
- theme: The theme to set for the widget. The default is None, which makes the function try to read the set theme property of the widget.