Dazzle.ThemeManager

g Dazzle.ThemeManager Dazzle.ThemeManager GObject.Object GObject.Object GObject.Object->Dazzle.ThemeManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_resources (resource_path)

remove_resources (resource_path)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Dazzle.ThemeManager(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Dazzle.ThemeManagerClass

classmethod new()
Return type:

Dazzle.ThemeManager

add_resources(resource_path)
Parameters:

resource_path (str) – A path to a Gio.Resources directory

This will automatically register resources found within resource_path.

If resource_path starts with “resource://”, embedded Gio.Resources will be used to locate the theme files. Otherwise, resource_path is expected to be a path on disk that may or may not exist.

If the resource_path contains a directory named “themes”, that directory will be traversed for files matching the theme name and variant. For example, if using the Adwaita theme, “themes/Adwaita.css” will be loaded. If the dark variant is being used, “themes/Adwaita-dark.css” will be loaeded. If no matching theme file is located, “themes/shared.css” will be loaded.

When the current theme changes, the CSS will be reloaded to adapt.

The “icons” sub-directory will be used to locate icon themes.

remove_resources(resource_path)
Parameters:

resource_path (str) – A previously registered resources path

This removes the CSS providers that were registered using resource_path.

You must have previously called Dazzle.ThemeManager.add_resources() for this function to do anything.

Since icons cannot be unloaded, previously loaded icons will continue to be available even after calling this function.