KDE 4.2 PyKDE API Reference

- KDE's Python API

# KIconTheme Class Reference

`from PyKDE4.kdeui import *`

## Detailed Description

Internal:
  Class to use/access icon themes in KDE. This class is used by the iconloader but can be used by others too.

Warning:
  You should not use this class externally. This class is exported because the KCM needs it.

See also:
  KIconLoader

## Enumerations

ContextMenus | { TextEditor, ReadOnlyText }

## Methods

| __init__ (self, QString name, QString appName=QString())
| __init__ (self, KIconTheme other)
int | defaultSize (self, KIconLoader.Group group)
int | depth (self)
QString | description (self)
QString | dir (self)
QString | example (self)
bool | hasContext (self, KIconLoader.Context context)
K3Icon | iconPath (self, QString name, int size, KIconLoader.MatchType match)
QStringList | inherits (self)
QString | internalName (self)
bool | isHidden (self)
bool | isValid (self)
QString | name (self)
QStringList | queryIcons (self, int size, KIconLoader.Context context=KIconLoader.Any)
QStringList | queryIconsByContext (self, int size, KIconLoader.Context context=KIconLoader.Any)
[int] | querySizes (self, KIconLoader.Group group)
QString | screenshot (self)

## Static Methods

| assignIconsToContextMenu (KIconTheme.ContextMenus type, [QActio] actions)
QString | current ()
QString | defaultThemeName ()
QStringList | list ()
| reconfigure ()

## Method Documentation

__init__ | ( | self, |
|  | QString | name,
|  | QString | appName=QString()
| ) |  |  |

Load an icon theme by name.

Parameters:

  | name | the name of the theme (e.g. "hicolor" or "keramik")
  | appName | the name of the application. Can be null. This argument allows applications to have themed application icons.

__init__ | ( | self, |
|  | KIconTheme | other
| ) |  |  |

assignIconsToContextMenu | ( | KIconTheme.ContextMenus | type,
|  | [QActio] | actions
| ) |  |  |

Assigns standard icons to the various standard text edit context menus.

QString current | ( |  | ) |

Returns the current icon theme.

Returns:
  the name of the current theme

int defaultSize | ( | self, |
|  | KIconLoader.Group | group
| ) |  |  |

The default size of this theme for a certain icon group.

Parameters:

  | group | The icon group. See KIconLoader.Group.

Returns:
  The default size in pixels for the given icon group.

QString defaultThemeName | ( |  | ) |

Returns the default icon theme.

Returns:
  the name of the default theme name

int depth | ( |  | self ) |

The minimum display depth required for this theme. This can either be 8 or 32.

Returns:
  the minimum bpp (8 or 32)

QString description | ( |  | self ) |

A description for the icon theme.

Returns:
  a human-readable description of the theme, QString() if there is none

QString dir | ( |  | self ) |

Returns the toplevel theme directory.

Returns:
  the directory of the theme

QString example | ( |  | self ) |

Return the name of the "example" icon. This can be used to present the theme to the user.

Returns:
  the name of the example icon, QString() if there is none

bool hasContext | ( | self, |
|  | KIconLoader.Context | context
| ) |  |  |

Returns true if the theme has any icons for the given context.

K3Icon iconPath | ( | self, |
|  | QString | name,
|  | int | size,
|  | KIconLoader.MatchType | match
| ) |  |  |

Lookup an icon in the theme.

Parameters:

  | name | The name of the icon, without extension.
  | size | The desired size of the icon.
  | match | The matching mode. KIconLoader.MatchExact returns an icon only if matches exactly. KIconLoader.MatchBest returns the best matching icon.

Returns:
  A K3Icon class that describes the icon. If an icon is found, an invalid K3Icon object otherwise.

See also:
  KIconLoader.isValid will return true, and false otherwise.

QStringList inherits | ( |  | self ) |

The themes this icon theme falls back on.

Returns:
  a list of icon themes that are used as fall-backs

QString internalName | ( |  | self ) |

The internal name of the icon theme (same as the name argument passed to the constructor).

Returns:
  the internal name of the theme

bool isHidden | ( |  | self ) |

The icon theme should be hidden to the user?

Returns:
  true if the icon theme is hidden

bool isValid | ( |  | self ) |

The icon theme exists?

Returns:
  true if the icon theme is valid

QStringList list | ( |  | ) |

List all icon themes installed on the system, global and local.

Returns:
  the list of all icon themes

QString name | ( |  | self ) |

The stylized name of the icon theme.

Returns:
  the (human-readable) name of the theme

QStringList queryIcons | ( | self, |
|  | int | size,
|  | KIconLoader.Context | context=KIconLoader.Any
| ) |  |  |

Query available icons for a size and context.

Parameters:

  | size | the size of the icons
  | context | the context of the icons

Returns:
  the list of icon names

QStringList queryIconsByContext | ( | self, |
|  | int | size,
|  | KIconLoader.Context | context=KIconLoader.Any
| ) |  |  |

Query available icons for a context and preferred size.

Parameters:

  | size | the size of the icons
  | context | the context of the icons

Returns:
  the list of icon names

[int] querySizes | ( | self, |
|  | KIconLoader.Group | group
| ) |  |  |

Query available sizes for a group.

Parameters:

  | group | The icon group. See KIconLoader.Group.

Returns:
  a list of available sized for the given group

reconfigure | ( |  | ) |

Reconfigure the theme.

QString screenshot | ( |  | self ) |

Return the name of the screenshot.

Returns:
  the name of the screenshot, QString() if there is none

## Enumeration Documentation

ContextMenus

Defines the context menus that assignIconsToContextMenus is aware of.

For ReadOnlyText the menu is expected to have one entry.

TextEditor is expected to have the full complement of undo, redo, cut, copy, paste and clear.

Enumerator:

  TextEditor |
  ReadOnlyText |