Skip to content
Snippets Groups Projects
Commit ce557dfa authored by Dicson's avatar Dicson
Browse files

Disable emoticons if emoticons.py is corrupted. Fixes #7414. Fixes #7513

parent dca6e4e9
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment