From 292a0ba99a5d29b5096c87f39242f69060d85d0a Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 19 Dec 2015 11:15:40 +0100 Subject: [PATCH] [tmolitor] add a way to sort emoticons in emoticon menu. Fixes #8204 --- src/gui_interface.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gui_interface.py b/src/gui_interface.py index caebdad6a..2b9420e37 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -2005,6 +2005,11 @@ class Interface: import imp imp.reload(emoticons) emots = emoticons.emoticons + self.emoticons_sorting = None + try: + self.emoticons_sorting = emoticons.sorting + except: + pass except Exception as e: return True for emot_filename in emots: @@ -2023,6 +2028,12 @@ class Interface: 16, 16) self.emoticons_images.append((emot, pix)) self.emoticons[emot.upper()] = emot_file + def emoticons_sorter(item): + try: + return self.emoticons_sorting.index(item[0]) + except: + return 0 + self.emoticons_images = sorted(self.emoticons_images, key=emoticons_sorter) del emoticons sys.path.remove(path) @@ -2087,7 +2098,7 @@ class Interface: ################################################################################ def join_gc_room(self, account, room_jid, nick, password, minimize=False, - is_continued=False): + is_continued=False): """ Join the room immediately """ @@ -2572,7 +2583,7 @@ class Interface: # we are not already connected minimize = bm['minimize'] in ('1', 'true') self.join_gc_room(account, jid, bm['nick'], - bm['password'], minimize = minimize) + bm['password'], minimize = minimize) elif jid in self.minimized_controls[account]: # more or less a hack: # On disconnect the minimized gc contact instances @@ -2772,6 +2783,7 @@ class Interface: self.emoticons = [] self.emoticons_animations = {} self.emoticons_images = {} + self.emoticons_sorting = None cfg_was_read = parser.read()