taurus.qt.qtgui.icon

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

Classes

Functions

getCachedPixmap(key, size=None)[source]

Returns a PyQt4.QtGui.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
Return type:

QPixmap

Returns:

getDevStateIcon(state, fallback=None)[source]

Gets a PyQt4.QtGui.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 (QIcon) – the fallback icon. Default is None.
Return type:

QIcon or None

Returns:

getDevStatePixmap(state, size=None)[source]

Gets a PyQt4.QtGui.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.
Return type:

QPixmap or None

Returns:

getDevStateToolTip(state)[source]
getElementTypeIcon(elemType, fallback=None)[source]

Gets a PyQt4.QtGui.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 (QIcon) – the fallback icon. Default is None.
Return type:

QIcon

Returns:

getElementTypeIconName(elemType)[source]

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
Return type:str
Returns:a string representing the icon name for the given taurus.core.taurusbasetypes.TaurusElementType
getElementTypePixmap(elemType, size=None)[source]

Gets a PyQt4.QtGui.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.
Return type:

QPixmap or None

Returns:

getElementTypeSize(elemType)[source]
getElementTypeToolTip(elemType)[source]
getStandardIcon(key, widget=None)[source]

Returns a PyQt4.QtGui.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 (StandardPixmap) – a standard pixmap which can follow some existing GUI style or guideline
  • widget (QWidget) – the widget argument (optional) can also be used to aid the determination of the icon.
Return type:

QIcon

Returns:

registerPathFiles(pathfilenames)[source]

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)[source]

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)[source]

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