From a725792f3630bfbfb45fe253b1cf815a420cf35b Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 5 Sep 2005 13:59:41 +0000 Subject: [PATCH] remove lazy exception catching and fix logic for previewing images --- src/config.py | 9 ++++++--- src/vcard.py | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/config.py b/src/config.py index 16f7c1daf..689f18794 100644 --- a/src/config.py +++ b/src/config.py @@ -1967,15 +1967,18 @@ class ManageEmoticonsWindow: model.remove(iter) else: gajim.config.add_per('emoticons', emot) - self.plugin.init_regexp() # update regexp [emoticons included] + self.plugin.init_regexp() # update regexp (emoticons included) gajim.config.set_per('emoticons', emot, 'path', model[iter][1].decode('utf-8')) - model.set_value(iter, 0, emot) + model[iter][0] = emot self.plugin.save_config() def update_preview(self, widget): path_to_file = widget.get_preview_filename() - if os.path.isdir(path_to_file): + if path_to_file is None or os.path.isdir(path_to_file): + # nothing to preview or directory + # make sure you clean image do show nothing + widget.get_preview_widget().set_from_file(None) return try: pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 32, 32) diff --git a/src/vcard.py b/src/vcard.py index 1fb3ae07a..83ca9d6fb 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -121,7 +121,10 @@ class VcardWindow: def update_preview(self, widget): path_to_file = widget.get_preview_filename() - if os.path.isdir(path_to_file): + if path_to_file is None or os.path.isdir(path_to_file): + # nothing to preview or directory + # make sure you clean image do show nothing + widget.get_preview_widget().set_from_file(None) return try: pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 100, 100)