diff --git a/src/config.py b/src/config.py index 7f44db774..5150998b0 100644 --- a/src/config.py +++ b/src/config.py @@ -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() diff --git a/src/gajim.py b/src/gajim.py index c9dd2fa87..bc2522415 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1652,12 +1652,12 @@ 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 - # initialize emoticons dictionary and unique images list + #initialize emoticons dictionary and unique images list self.emoticons_images = list() self.emoticons = dict() @@ -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()