def __get_image(index): path = getResource(index, ["Images", "Icons"]) if path is not None: return QtGui.QPixmap(path) else: #Standard Icon return get_std_icon(index).pixmap(32)
def get_icon(self, index): index = self.map_index(index) std = get_std_icon(index) if not std.isNull(): return std path = self.find_source(index, ["Icons", "External"]) if path is not None: return QtGui.QIcon(path) return self._from_theme(index)
def get_image(self, index): index = self.map_index(index) std = get_std_icon(index) if not std.isNull(): return std.pixmap(32) path = self.find_source(index, ["Images", "Icons"]) if path is not None: return QtGui.QPixmap(path) return self._from_theme(index).pixmap(32)
def __get_icon(index): ''' Makes the best effort to find an icon for an index. Index can be a path, a Qt resource path, an integer. @return: QIcon instance or None if no icon could be retrieved ''' if isinstance(index, six.string_types): if os.path.exists(index) and os.path.isabs(index): #File path Icon return __fileIconProvider.icon(QtCore.QFileInfo(index)) elif QtGui.QIcon.hasThemeIcon(index): #Theme Icon return QtGui.QIcon._fromTheme(index) else: #Try icon in the prymatex's resources path = getResource(index, ["Icons", "External"]) if path is not None: return QtGui.QIcon(path) #Standard Icon return get_std_icon(index) elif isinstance(index, six.integer_types): #Icon by int index in fileicon provider return __fileIconProvider.icon(index)