[tmolitor] add a way to sort emoticons in emoticon menu. Fixes #8204

This commit is contained in:
Yann Leboulanger 2015-12-19 11:15:40 +01:00
parent 7c9a5aa429
commit 292a0ba99a
1 changed files with 14 additions and 2 deletions

View File

@ -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()