warn user when emoticon theme can't be loaded. fixed #3696

This commit is contained in:
Yann Leboulanger 2008-03-14 08:46:10 +00:00
parent 323c50ec44
commit e572a0cd65
1 changed files with 5 additions and 0 deletions

View File

@ -2554,6 +2554,8 @@ class Interface:
# It's maybe a user theme # It's maybe a user theme
path = os.path.join(gajim.MY_EMOTS_PATH, emot_theme) path = os.path.join(gajim.MY_EMOTS_PATH, emot_theme)
if not os.path.exists(path): # theme doesn't exist, disable emoticons if not os.path.exists(path): # theme doesn't exist, disable emoticons
dialogs.WarningDialog(_('Emoticons disabled'),
_('Your configured emoticons theme has not been found, so emoticons have been disabled.'))
gajim.config.set('emoticons_theme', '') gajim.config.set('emoticons_theme', '')
return return
sys.path.append(path) sys.path.append(path)
@ -2578,6 +2580,9 @@ class Interface:
self.emoticons[emot.upper()] = emot_file self.emoticons[emot.upper()] = emot_file
sys.path.remove(path) sys.path.remove(path)
del emoticons del emoticons
if len(self.emoticons) == 0:
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.'))
if self.emoticons_menu: if self.emoticons_menu:
self.emoticons_menu.destroy() self.emoticons_menu.destroy()
self.emoticons_menu = self.prepare_emoticons_menu() self.emoticons_menu = self.prepare_emoticons_menu()