changeset e65971276cf2 in /home/hg/repos/gajim
author: Denis Fomin fominde@gmail.com branches: gajim_0.16 details:http://hg.gajim.org/gajim?cmd=changeset;node=e65971276cf2 description: Disable emoticons if emoticons.py is corrupted. Fixes #7414. Fixes #7513
diffstat:
src/gui_interface.py | 25 ++++++++++++++++++------- 1 файлов изменено, 18 вставок(+), 7 удалений(-)
различия (50 строк):
diff -r 67a5b3059a0f -r e65971276cf2 src/gui_interface.py --- a/src/gui_interface.py Sat Oct 19 12:32:01 2013 +0400 +++ b/src/gui_interface.py Sat Oct 19 14:06:06 2013 +0400 @@ -1955,13 +1955,16 @@ 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 @@ 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 @@ '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()