@memoize
def from_theme(name, fallback=None):
 if hasattr(QtGui.QIcon, u'fromTheme'):
  (base, ext) = os.path.splitext(name)
  if fallback:
   qicon = QtGui.QIcon.fromTheme(base, icon(fallback))
  else:
   qicon = QtGui.QIcon.fromTheme(base)
  if (not qicon.isNull()):
   return qicon
 return icon((fallback or name))

@ memoize def from_theme ( name , fallback = None ) : if hasattr ( QtGui . QIcon , u'fromTheme' ) : ( base , ext ) = os . path . splitext ( name ) if fallback : qicon = QtGui . QIcon . fromTheme ( base , icon ( fallback ) ) else : qicon = QtGui . QIcon . fromTheme ( base ) if ( not qicon . isNull ( ) ) : return qicon return icon ( ( fallback or name ) )
grab an icon from the current theme with a fallback support older versions of qt checking for fromthemes availability .