[thorstenp] sort emoticons with sorted function. See #4457
This commit is contained in:
parent
7cb91c8b08
commit
bf169f302a
12
src/gajim.py
12
src/gajim.py
|
@ -2460,8 +2460,7 @@ class Interface:
|
||||||
# expanded. e.g., foo:) NO, foo :) YES, (brb) NO, (:)) YES, etc.
|
# expanded. e.g., foo:) NO, foo :) YES, (brb) NO, (:)) YES, etc.
|
||||||
# We still allow multiple emoticons side-by-side like :P:P:P
|
# We still allow multiple emoticons side-by-side like :P:P:P
|
||||||
# sort keys by length so :qwe emot is checked before :q
|
# sort keys by length so :qwe emot is checked before :q
|
||||||
keys = self.emoticons.keys()
|
keys = sorted(self.emoticons, key=len, reverse=True)
|
||||||
keys.sort(self.on_emoticon_sort)
|
|
||||||
emoticons_pattern_prematch = ''
|
emoticons_pattern_prematch = ''
|
||||||
emoticons_pattern_postmatch = ''
|
emoticons_pattern_postmatch = ''
|
||||||
emoticon_length = 0
|
emoticon_length = 0
|
||||||
|
@ -2494,15 +2493,6 @@ class Interface:
|
||||||
# Invalid XML chars
|
# Invalid XML chars
|
||||||
self.invalid_XML_chars = u'[\x00-\x08]|[\x0b-\x0c]|[\x0e-\x19]|[\ud800-\udfff]|[\ufffe-\uffff]'
|
self.invalid_XML_chars = u'[\x00-\x08]|[\x0b-\x0c]|[\x0e-\x19]|[\ud800-\udfff]|[\ufffe-\uffff]'
|
||||||
|
|
||||||
def on_emoticon_sort(self, emot1, emot2):
|
|
||||||
len1 = len(emot1)
|
|
||||||
len2 = len(emot2)
|
|
||||||
if len1 < len2:
|
|
||||||
return 1
|
|
||||||
elif len1 > len2:
|
|
||||||
return -1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def popup_emoticons_under_button(self, button, parent_win):
|
def popup_emoticons_under_button(self, button, parent_win):
|
||||||
''' pops emoticons menu under button, located in parent_win'''
|
''' pops emoticons menu under button, located in parent_win'''
|
||||||
gtkgui_helpers.popup_emoticons_under_button(self.emoticons_menu,
|
gtkgui_helpers.popup_emoticons_under_button(self.emoticons_menu,
|
||||||
|
|
Loading…
Reference in New Issue