mirror of https://gitlab.com/openlp/openlp.git
locale aware song sorting
This commit is contained in:
parent
465515d71e
commit
7e221a6e98
|
@ -25,6 +25,7 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import locale
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
@ -215,6 +216,7 @@ class SongMediaItem(MediaManagerItem):
|
||||||
def displayResultsSong(self, searchresults):
|
def displayResultsSong(self, searchresults):
|
||||||
log.debug(u'display results Song')
|
log.debug(u'display results Song')
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
|
searchresults.sort(cmp=self.collateSongTitles)
|
||||||
for song in searchresults:
|
for song in searchresults:
|
||||||
author_list = u''
|
author_list = u''
|
||||||
for author in song.authors:
|
for author in song.authors:
|
||||||
|
@ -439,3 +441,9 @@ class SongMediaItem(MediaManagerItem):
|
||||||
if editId != 0:
|
if editId != 0:
|
||||||
Receiver.send_message(u'service_item_update',
|
Receiver.send_message(u'service_item_update',
|
||||||
u'%s:%s' %(editId, uuid))
|
u'%s:%s' %(editId, uuid))
|
||||||
|
|
||||||
|
def collateSongTitles(self, song_1, song_2):
|
||||||
|
"""
|
||||||
|
Locale aware collation of song titles
|
||||||
|
"""
|
||||||
|
return locale.strcoll(unicode(song_1.title), unicode(song_2.title))
|
||||||
|
|
Loading…
Reference in New Issue