def _updateAvatar(userid, outputdir): picname = "avatar-" + userid + ".jpg" outpath = os.path.join(outputdir, picname) try: os.remove(outpath) except: pass # it wasn't there anyway # We export pics for all the contacts but only the ones whose jpg doesn't exist already DbClient.exportAvatars(outputdir) # Inform all interested listeners that there's been some change with the given url DbResourceNotifier.getInstance().notify(picname)
def __init__(self, parent): QtWebKit.QWebView.__init__(self) self.parent = parent self.navInterceptor = NavigationInterceptor(parent) self.setPage(Webpage()) self.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateExternalLinks) self.page().setNetworkAccessManager(self.navInterceptor) self.connect(self.page(), QtCore.SIGNAL("linkClicked(const QUrl&)"), parent.slotLinkClicked) DbResourceNotifier.getInstance().addListener(self)
def _updateAvatar(userid, outputdir): picname = "avatar-" + userid + ".jpg" outpath = os.path.join(outputdir, picname) # print("outpath = ", outpath) try: os.remove(outpath) except: pass # it wasn't there anyway # We export pics for all the contacts but only the ones whose jpg doesn't exist already DbI.exportAllAvatars(outputdir) # Inform all interested listeners that there's been some change with the given url DbResourceNotifier.getInstance().notify(picname)