def getUserDisplayPicture(self, contact, width=96, height=96, forceResize=False): '''return a pixbuf with the display picture of the user or the default image if not found''' imagePath = os.path.join(self.config.getCachePath(), \ contact.displayPicturePath) try: if os.path.exists(imagePath) and os.path.isfile(imagePath): pixbuf = gtk.gdk.pixbuf_new_from_file(imagePath) else: lastCached = getLastCachedAvatar(contact.email, self.config.getCachePath()) if os.path.isfile(lastCached): pixbuf = gtk.gdk.pixbuf_new_from_file(lastCached) else: pixbuf = self.getImage('login') except: pixbuf = self.getImage('login') if width == 96 and height == 96 and not forceResize: return pixbuf else: return resizePixbuf(pixbuf, width, height)
def get_last_display_picture(self, email='', cache=True): imagePath='noImage' lista = [] if cache: try: cachePath = self.controller.config.getCachePath() contact = self.controller.getContact(email) except Exception, e: debug("Exception when getting contact %s" % str(e)) return imagePath imagePath = os.path.join(cachePath, contact.displayPicturePath) if os.path.exists( imagePath ) and os.path.isfile( imagePath ): debug("Dbus.get_last_display_picture: ImagePath for contact %s = %s" % (email, imagePath)) return imagePath else: imagePath = getLastCachedAvatar(contact.email, cachePath) if os.path.isfile(imagePath): debug("Dbus.get_last_display_picture: ImagePath for contact %s = %s" % (email, imagePath)) return imagePath imagePath = 'noImage'
def getUserDisplayPicture(self, contact, width=96, height=96): '''return a pixbuf with the display picture of the user or the default image if not found''' imagePath = os.path.join(self.config.getCachePath(), \ contact.displayPicturePath) try: if os.path.exists(imagePath) and os.path.isfile(imagePath): pixbuf = gtk.gdk.pixbuf_new_from_file(imagePath) else: lastCached=getLastCachedAvatar(contact.email, self.config.getCachePath()) if os.path.isfile(lastCached): pixbuf = gtk.gdk.pixbuf_new_from_file(lastCached) else: pixbuf = self.getImage('login') except: pixbuf = self.getImage('login') if width == 96 and height == 96: return pixbuf else: return resizePixbuf(pixbuf, width, height)
def get_last_display_picture(self, email='', cache=True): imagePath = 'noImage' lista = [] if cache: try: cachePath = self.controller.config.getCachePath() contact = self.controller.getContact(email) except Exception, e: debug("Exception when getting contact %s" % str(e)) return imagePath imagePath = os.path.join(cachePath, contact.displayPicturePath) if os.path.exists(imagePath) and os.path.isfile(imagePath): debug( "Dbus.get_last_display_picture: ImagePath for contact %s = %s" % (email, imagePath)) return imagePath else: imagePath = getLastCachedAvatar(contact.email, cachePath) if os.path.isfile(imagePath): debug( "Dbus.get_last_display_picture: ImagePath for contact %s = %s" % (email, imagePath)) return imagePath imagePath = 'noImage'