[elghinn/jim]Correctly reload emoticons set :). Fixes #2445

This commit is contained in:
Jean-Marie Traissard 2006-11-06 05:37:29 +00:00
parent dcbde70325
commit e8d2bfe1ce
2 changed files with 9 additions and 5 deletions

View File

@ -577,7 +577,7 @@ class PreferencesWindow:
else:
gajim.config.set('emoticons_theme', emot_theme)
gajim.interface.init_emoticons()
gajim.interface.init_emoticons(need_reload = True)
gajim.interface.make_regexps()
self.toggle_emoticons()

View File

@ -1652,7 +1652,7 @@ class Interface:
menu.show_all()
return menu
def init_emoticons(self):
def init_emoticons(self, need_reload = False):
emot_theme = gajim.config.get('emoticons_theme')
if not emot_theme:
return
@ -1668,7 +1668,11 @@ class Interface:
if not os.path.exists(path): # theme doesn't exist
return
sys.path.append(path)
from emoticons import emoticons as emots
import emoticons
if need_reload:
# we need to reload else that doesn't work when changing emoticon set
reload(emoticons)
emots = emoticons.emoticons
for emot in emots:
emot_file = os.path.join(path, emots[emot])
if not self.image_is_ok(emot_file):
@ -1682,7 +1686,7 @@ class Interface:
self.emoticons_images.append((emot, pix))
self.emoticons[emot.upper()] = emot_file
sys.path.remove(path)
del emots
del emoticons
if self.emoticons_menu:
self.emoticons_menu.destroy()
self.emoticons_menu = self.prepare_emoticons_menu()