catch and pass on exception of pixbufloader

This commit is contained in:
Nikos Kouremenos 2005-08-08 23:06:48 +00:00
parent fb40117581
commit 07fecda486
1 changed files with 17 additions and 13 deletions

View File

@ -192,19 +192,23 @@ class TabbedChatWindow(chat.Chat):
pass pass
if img_decoded: if img_decoded:
pixbufloader = gtk.gdk.PixbufLoader() pixbufloader = gtk.gdk.PixbufLoader()
pixbufloader.write(img_decoded) try:
pixbuf = pixbufloader.get_pixbuf() pixbufloader.write(img_decoded)
pixbufloader.close() pixbuf = pixbufloader.get_pixbuf()
scaled_buf = pixbuf.scale_simple(52, 52, gtk.gdk.INTERP_HYPER) pixbufloader.close()
x = None
if self.xmls.has_key(vcard['jid']): scaled_buf = pixbuf.scale_simple(52, 52, gtk.gdk.INTERP_HYPER)
x = self.xmls[vcard['jid']] x = None
# it can be xmls[jid/resource] if it's a vcard from pm if self.xmls.has_key(vcard['jid']):
elif self.xmls.has_key(vcard['jid'] + '/' + vcard['resource']): x = self.xmls[vcard['jid']]
x = self.xmls[vcard['jid'] + '/' + vcard['resource']] # it can be xmls[jid/resource] if it's a vcard from pm
image = x.get_widget('avatar_image') elif self.xmls.has_key(vcard['jid'] + '/' + vcard['resource']):
image.set_from_pixbuf(scaled_buf) x = self.xmls[vcard['jid'] + '/' + vcard['resource']]
image.show_all() image = x.get_widget('avatar_image')
image.set_from_pixbuf(scaled_buf)
image.show_all()
except gobject.GError: # we may get "unknown image format"
pass
def set_state_image(self, jid): def set_state_image(self, jid):
prio = 0 prio = 0