# `taurus.qt.qtgui.icon`

Utilities for using the bundled icons in Taurus and for registering external sources of icons.

Classes

class QIconCatalog(parent=None)

  A widget that shows a tab for each registered search path prefix. In each tab, all icons available for the corresponding prefix are displayed. Clicking on an icon provides info on how to use it from a taurus application.

  (more info)

Functions

getCachedPixmap(key, size=None)

  Returns a PyQt5.Qt.QPixmap object for the given key and size. The key argument supports QDir’s searchPath prefixes (see `QDir.setSearchPaths()`).

  Parameters:

    - key (str) – the pixmap key., e.g.: ‘status:folder-open.svg’

    - size (int) – the pixmap size in pixels (will get a square pixmap). If None is passed it will return the original size

  Returns:

  Return type:

    PyQt5.Qt.QPixmap

getDevStateIcon(state, fallback=None)

  Gets a PyQt5.Qt.QIcon object for the given `taurus.core.taurusbasetypes.TaurusDevState`.

  If an icon cannot be found for the given state, fallback is returned.

  Parameters:

    - state (TaurusDevState) – the taurus device state

    - fallback (PyQt5.Qt.QIcon) – the fallback icon. Default is None.

  Returns:

  Return type:

    PyQt5.Qt.QIcon or None

getDevStatePixmap(state, size=None)

  Gets a PyQt5.Qt.QPixmap object for the given `taurus.core.taurusbasetypes.TaurusDevState`.

  Parameters:

    - state (TaurusDevState) – the taurus software device state

    - size (int) – the pixmap size in pixels (will get a square pixmap). Default is None meaning it will return the original size.

  Returns:

  Return type:

    PyQt5.Qt.QPixmap or None

getDevStateToolTip(state)

getElementTypeIcon(elemType, fallback=None)

  Gets a PyQt5.Qt.QIcon object for the given `taurus.core.taurusbasetypes.TaurusElementType`.

  If an icon cannot be found for the given TaurusElementType, fallback is returned.

  Parameters:

    - elemType (TaurusElementType) – the taurus element type

    - fallback (PyQt5.Qt.QIcon) – the fallback icon. Default is None.

  Returns:

  Return type:

    PyQt5.Qt.QIcon

getElementTypeIconName(elemType)

  Gets an icon name string for the given `taurus.core.taurusbasetypes.TaurusElementType`.

  If an icon name cannot be found for elemType, None is returned.

  Parameters:

    elemType (TaurusElementType) – the taurus element type

  Returns:

    a string representing the icon name for the given `taurus.core.taurusbasetypes.TaurusElementType`

  Return type:

    str

getElementTypePixmap(elemType, size=None)

  Gets a PyQt5.Qt.QPixmap object for the given `taurus.core.taurusbasetypes.TaurusElementType`.

  Parameters:

    - elemType (TaurusElementType) – the taurus element type

    - size (int) – the pixmap size in pixels (will get a square pixmap). Default is None meaning it will return the original size.

  Returns:

  Return type:

    PyQt5.Qt.QPixmap or None

getElementTypeSize(elemType)

getElementTypeToolTip(elemType)

getStandardIcon(key, widget=None)

  Returns a PyQt5.Qt.QIcon object for the given key. Key should be a QStyle.StandardPixmap enumeration member. The widget argument is optional and can also be used to aid the determination of the icon.

  Parameters:

    - key (QStyle.StandardPixmap) – a standard pixmap which can follow some existing GUI style or guideline

    - widget (Qt.QWidget) – the widget argument (optional) can also be used to aid the determination of the icon.

  Returns:

  Return type:

    PyQt5.Qt.QIcon

registerPathFiles(pathfilenames)

  Use given .path files to update Qt’s search path Each path file contains a json-encoded list of (prefix,path) tuples. This function will call Qt.QDir.addSearchPath with each of the tuples from the path files (prefix values will be sanitized first, and relative path values will be made relative to the dir containing the .path file)

  Parameters:

    pathfilenames (list<str>) – list of .path file names

registerTheme(name='Tango', path='', force=False)

  Use bundled them if OS does not define a theme (non-X11 systems)

  Parameters:

    - name (str) – icon theme name (default=Tango)

    - path (str) – path to dir containing the theme (absolute or relative to dir of taurus.qt.qtgui.icon). Default = ‘’

    - force (bool) – Force to set path even if a theme is already set

sanitizePrefix(prefix)

  strips any leading ‘/’ and substitutes non alphanumeric characters by ‘_’

Variables

REGISTERED_PREFIXES