diff --git a/src/gui_interface.py b/src/gui_interface.py index db623df20b2a0bd556ef0a13e3f7483f85f25a6a..123027c585f3d27077e0841bc4848f2226446124 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -1955,13 +1955,16 @@ class Interface: self.emoticons = dict() self.emoticons_animations = dict() - sys.path.append(path) + sys.path.insert(0, path) import emoticons - if need_reload: - # we need to reload else that doesn't work when changing emoticon - # set - reload(emoticons) - emots = emoticons.emoticons + try: + if need_reload: + # we need to reload else that doesn't work when changing emoticon + # set + reload(emoticons) + emots = emoticons.emoticons + except Exception, e: + return True for emot_filename in emots: emot_file = os.path.join(path, emot_filename) if not self.image_is_ok(emot_file): @@ -2002,7 +2005,14 @@ class Interface: transient_for=transient_for) gajim.config.set('emoticons_theme', '') return - self._init_emoticons(path, need_reload) + if self._init_emoticons(path, need_reload): + dialogs.WarningDialog(_('Emoticons disabled'), + _('Your configured emoticons theme cannot been loaded. You ' + 'maybe need to update the format of emoticons.py file. See ' + 'http://trac.gajim.org/wiki/Emoticons for more details.'), + transient_for=transient_for) + gajim.config.set('emoticons_theme', '') + return if len(self.emoticons) == 0: # maybe old format of emoticons file, try to convert it try: @@ -2025,6 +2035,7 @@ class Interface: 'maybe need to update the format of emoticons.py file. See ' 'http://trac.gajim.org/wiki/Emoticons for more details.'), transient_for=transient_for) + gajim.config.set('emoticons_theme', '') if self.emoticons_menu: self.emoticons_menu.destroy() self.emoticons_menu = self.prepare_emoticons_menu()