scale and catch for avatar & emoticon

This commit is contained in:
Nikos Kouremenos 2005-09-05 13:35:45 +00:00
parent 72393ac068
commit ef06e78abb
3 changed files with 15 additions and 3 deletions

View File

@ -1975,7 +1975,13 @@ class ManageEmoticonsWindow:
def update_preview(self, widget): def update_preview(self, widget):
path_to_file = widget.get_preview_filename() path_to_file = widget.get_preview_filename()
widget.get_preview_widget().set_from_file(path_to_file) if os.path.isdir(path_to_file):
return
try:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 32, 32)
except (gobject.GError, TypeError):
return
widget.get_preview_widget().set_from_pixbuf(pixbuf)
def on_set_image_button_clicked(self, widget, data=None): def on_set_image_button_clicked(self, widget, data=None):
(model, iter) = self.emot_tree.get_selection().get_selected() (model, iter) = self.emot_tree.get_selection().get_selected()

View File

@ -19,6 +19,7 @@
import gtk import gtk
import gtk.glade import gtk.glade
import gobject
import urllib import urllib
import base64 import base64
import mimetypes import mimetypes
@ -120,7 +121,12 @@ class VcardWindow:
def update_preview(self, widget): def update_preview(self, widget):
path_to_file = widget.get_preview_filename() path_to_file = widget.get_preview_filename()
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 100, 100) if os.path.isdir(path_to_file):
return
try:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 100, 100)
except gobject.GError:
return
widget.get_preview_widget().set_from_pixbuf(pixbuf) widget.get_preview_widget().set_from_pixbuf(pixbuf)
def on_set_avatar_button_clicked(self, widget): def on_set_avatar_button_clicked(self, widget):