def __check_icon_theme_compliance(self): from python_qt_binding.QtGui import QIcon # TODO find a better way to verify Theme standard compliance if QIcon.themeName() == '' or \ QIcon.fromTheme('document-save').isNull() or \ QIcon.fromTheme('document-open').isNull() or \ QIcon.fromTheme('edit-cut').isNull() or \ QIcon.fromTheme('object-flip-horizontal').isNull(): original_theme = QIcon.themeName() QIcon.setThemeName('Tango') if QIcon.fromTheme('document-save').isNull(): QIcon.setThemeName(original_theme)
def _check_icon_theme_compliance(self): from python_qt_binding.QtGui import QIcon # TODO find a better way to verify Theme standard compliance if QIcon.themeName() == '' or \ QIcon.fromTheme('document-save').isNull() or \ QIcon.fromTheme('document-open').isNull() or \ QIcon.fromTheme('edit-cut').isNull() or \ QIcon.fromTheme('object-flip-horizontal').isNull(): if 'darwin' in platform.platform().lower() and '/usr/local/share/icons' not in QIcon.themeSearchPaths(): QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + ['/usr/local/share/icons']) original_theme = QIcon.themeName() QIcon.setThemeName('Tango') if QIcon.fromTheme('document-save').isNull(): QIcon.setThemeName(original_theme)
def _set_theme_if_necessary(self): from python_qt_binding.QtGui import QIcon # Always prefer tango_icons_vendor package_path = has_resource('packages', 'tango_icons_vendor') if package_path: icon_paths = QIcon.themeSearchPaths() icon_paths = [ os.path.join(package_path, 'share', 'tango_icons_vendor', 'resource', 'icons') ] + icon_paths QIcon.setThemeSearchPaths(icon_paths) # Use Tango if possible, fall back to system default original_theme = QIcon.themeName() QIcon.setThemeName('Tango') if QIcon.fromTheme('document-save').isNull(): QIcon.setThemeName(original_theme)