Skip to content
Mihaly Konda edited this page Nov 12, 2025 · 2 revisions

theme

version: v1.1.8

A module for setting a pre-defined theme to Qt objects.


object WidgetTheme [src]

Singleton object of the type _WidgetTheme, containing the types defined in the source JSON file.


function get_theme_types() [src]

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 ThemeParameters [src]

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.

[src]

def __post_init__(self) -> None

Defines the default colours.


[src]

def write_json(self, destination: str) -> None

Writes the content to a JSON file.

Parameters:

  • destination: Path where the file should be written to.

class _WidgetTheme(metaclass=Singleton) [src]

A class for Enum-like access to themes.


[src]

def __init__(self) -> None

Initializer for the class.


[src]

    def __getattr__(self, name: str) -> ThemeParameters

Handles 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.


[src]

def load_dict(self) -> None

Loads the content of theme JSONs into the internal dictionary.


function set_widget_theme() [src]

def set_widget_theme(widget: QWidgetT, theme: ThemeParameters = None) -> None

Sets 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.

function write_stub() [src]

def write_stub() -> None

Writes the stub file to the project directory if it doesn't exist already or if an external stub file directory is set it creates a new stub file there (and deletes the package's own) or overrides the existing one.

API reference

Base/technical modules:

Other modules

Clone this wiki locally