diff options
author | Jean-Marie Traissard <jim@lapin.org> | 2007-05-14 11:05:18 +0400 |
---|---|---|
committer | Jean-Marie Traissard <jim@lapin.org> | 2007-05-14 11:05:18 +0400 |
commit | 2052410b3c400da9eb19c7477c6ecaeb3969ba96 (patch) | |
tree | 7b8d27d156b8779e712465aa7b72b8593d7b2e1a /src/profile_window.py | |
parent | c4d10a780eee6d36e4b41b9ae85c6e68ca17ce72 (diff) |
Choosing an avatar : Catch also invalid format errors for files < 16kb
Diffstat (limited to 'src/profile_window.py')
-rw-r--r-- | src/profile_window.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/profile_window.py b/src/profile_window.py index 1e1bda1dc..4f98e20a8 100644 --- a/src/profile_window.py +++ b/src/profile_window.py @@ -132,7 +132,7 @@ class ProfileWindow: try: pixbuf = gtk.gdk.pixbuf_new_from_file(path_to_file) # get the image at 'notification size' - # and use that user did not specify in ACE crazy size + # and hope that user did not specify in ACE crazy size scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'tooltip') except gobject.GError, msg: # unknown format @@ -149,13 +149,17 @@ class ProfileWindow: 'avatar_scaled.png') scaled_pixbuf.save(path_to_file, 'png') must_delete = True - self.dialog.destroy() - + fd = open(path_to_file, 'rb') data = fd.read() pixbuf = gtkgui_helpers.get_pixbuf_from_data(data) - # rescale it - pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard') + try: + # rescale it + pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard') + except AttributeError: # unknown format + dialogs.ErrorDialog(_('Could not load image'), msg) + return + self.dialog.destroy() button = self.xml.get_widget('PHOTO_button') image = button.get_image() image.set_from_pixbuf(pixbuf) |