def icon_url_changed(self, url): dc = QApplication.instance().disk_cache.data(url) if dc is not None: with closing(dc): raw = dc.readAll() p = QPixmap() p.loadFromData(raw) if not p.isNull(): ic = QIcon() ic.addPixmap(p) self.set_data(DECORATION_ROLE, ic)
def icon(self): if self._icon is None: self._icon = QIcon() url = places.favicon_url(self.place_id) if url is not None: f = QApplication.instance().disk_cache.data(QUrl(url)) if f is not None: with closing(f): raw = f.readAll() p = QPixmap() p.loadFromData(raw) if not p.isNull(): self._icon.addPixmap(p) return self._icon