def initialize(): """Initialize support for the icons. Called on app startup.""" QDir.setSearchPaths("icons", __path__) # use our icon theme (that builds on Tango) if there are no system icons if (not QIcon.themeName() or QIcon.themeName() == "hicolor" or not QSettings().value("system_icons", True, bool)): QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__) QIcon.setThemeName("TangoExt")
def initialize(): """Initialize support for the icons. Called on app startup.""" # find the icons in this directory, after that also search in the included # icon theme folders (this fallback is used if the "Use system icons" # setting is enabled, but the system does not provide a certain icon. d = __path__[0] path = [] path.extend(__path__) for p in (os.path.join(d, 'TangoExt', 'scalable'), os.path.join(d, 'TangoExt'), os.path.join(d, 'Tango', 'scalable'), os.path.join(d, 'Tango')): if os.path.isdir(p): path.append(p) QDir.setSearchPaths("icons", path) # use our icon theme (that builds on Tango) if there are no system icons if (not QIcon.themeName() or QIcon.themeName() == "hicolor" or not QSettings().value("system_icons", True, bool)): QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__) QIcon.setThemeName("TangoExt")
# See http://www.gnu.org/licenses/ for more information. """ Icons. """ from __future__ import unicode_literals import os from PyQt4.QtCore import QDir, QFile, QFileInfo, QSettings, QSize from PyQt4.QtGui import QFileIconProvider, QIcon _cache = {} QDir.setSearchPaths("icons", __path__) # use our icon theme (that builds on Tango) if there are no system icons if (not QIcon.themeName() or QIcon.themeName() == "hicolor" or QSettings().value("system_icons", True) in (False, "false")): QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__) QIcon.setThemeName("TangoExt") def get(name): """Returns an icon with the specified name.""" if QIcon.hasThemeIcon(name): return QIcon.fromTheme(name) try: return _cache[name]
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # See http://www.gnu.org/licenses/ for more information. """ Icons. """ from __future__ import unicode_literals import os from PyQt4.QtCore import QDir, QFile, QFileInfo, QSettings, QSize from PyQt4.QtGui import QFileIconProvider, QIcon _cache = {} QDir.setSearchPaths("icons", __path__) # use our icon theme (that builds on Tango) if there are no system icons if (not QIcon.themeName() or QIcon.themeName() == "hicolor" or not QSettings().value("system_icons", True, bool)): QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__) QIcon.setThemeName("TangoExt") def get(name): """Returns an icon with the specified name.""" if QIcon.hasThemeIcon(name): return QIcon.fromTheme(name) try: return _cache[name] except KeyError: