wx_icons_hicolor.icon_theme

Class to represent an icon theme.

Classes:

HicolorIconTheme(name, comment, directories)

The Hicolor Icon Theme.

IconTheme(name, comment, directories[, …])

Represents an icon theme.

class HicolorIconTheme(name, comment, directories, inherits=None, scaled_directories=None, hidden=False, example='')[source]

Bases: IconTheme

The Hicolor Icon Theme.

Parameters
  • name (str) – short name of the icon theme, used in e.g. lists when selecting themes.

  • comment (str) – longer string describing the theme

  • inherits (Optional[Sequence[str]]) –

    The name of the theme that this theme inherits from. If an icon name is not found in the current theme, it is searched for in the inherited theme (and recursively in all the inherited themes). Default None.

    If no theme is specified implementations are required to add the “hicolor” theme to the inheritance tree. An implementation may optionally add other default themes in between the last specified theme and the hicolor theme.

  • directories (Sequence[Directory]) – list of subdirectories for this theme. For every subdirectory there must be a section in the index.theme file describing that directory.

  • scaled_directories (Optional[Sequence[Directory]]) – Additional list of subdirectories for this theme, in addition to the ones in Directories. These directories should only be read by implementations supporting scaled directories and was added to keep compatibility with old implementations that don’t support these. Default None.

  • hidden (bool) – Whether to hide the theme in a theme selection user interface. This is used for things such as fallback-themes that are not supposed to be visible to the user. Default False.

  • example (str) – The name of an icon that should be used as an example of how this theme looks. Default ''.

Methods:

create()

Create an instance of the Hicolor Icon Theme.

classmethod create()[source]

Create an instance of the Hicolor Icon Theme.

Return type

HicolorIconTheme

class IconTheme(name, comment, directories, inherits=None, scaled_directories=None, hidden=False, example='')[source]

Bases: Dictable

Represents an icon theme.

Parameters
  • name (str) – short name of the icon theme, used in e.g. lists when selecting themes.

  • comment (str) – longer string describing the theme

  • inherits (Optional[Sequence[str]]) –

    The name of the theme that this theme inherits from. If an icon name is not found in the current theme, it is searched for in the inherited theme (and recursively in all the inherited themes). Default None.

    If no theme is specified implementations are required to add the “hicolor” theme to the inheritance tree. An implementation may optionally add other default themes in between the last specified theme and the hicolor theme.

  • directories (Sequence[Directory]) – list of subdirectories for this theme. For every subdirectory there must be a section in the index.theme file describing that directory.

  • scaled_directories (Optional[Sequence[Directory]]) – Additional list of subdirectories for this theme, in addition to the ones in Directories. These directories should only be read by implementations supporting scaled directories and was added to keep compatibility with old implementations that don’t support these. Default None.

  • hidden (bool) – Whether to hide the theme in a theme selection user interface. This is used for things such as fallback-themes that are not supposed to be visible to the user. Default False.

  • example (str) – The name of an icon that should be used as an example of how this theme looks. Default ''.

Methods:

__repr__()

Return a string representation of the IconTheme.

__str__()

Return str(self).

find_icon(icon_name, size, scale[, …])

Searches for the icon with the given name and size.

from_configparser(theme_index_path)

Constructs a IconTheme from config file.

__repr__()[source]

Return a string representation of the IconTheme.

Return type

str

__str__()[source]

Return str(self).

Return type

str

find_icon(icon_name, size, scale, prefer_this_theme=True)[source]

Searches for the icon with the given name and size.

Parameters
  • icon_name (str) – The name of the icon to find. Any FreeDesktop Icon Theme Specification name can be used.

  • size (int) – The desired size of the icon

  • scale (Any) – TODO: Currently does nothing

  • prefer_this_theme (bool) – Return an icon from this theme even if it has to be resized, rather than a correctly sized icon from the parent theme. Default True.

Return type

Optional[Icon]

Returns

The icon if it was found, or None.

classmethod from_configparser(theme_index_path)[source]

Constructs a IconTheme from config file.

Parameters

theme_index_path (Union[str, Path, PathLike])

Return type

IconTheme