forked from openlp/openlp
locale aware song sorting
This commit is contained in:
parent
465515d71e
commit
7e221a6e98
@ -25,6 +25,7 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
import locale
|
||||
import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
@ -215,6 +216,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
def displayResultsSong(self, searchresults):
|
||||
log.debug(u'display results Song')
|
||||
self.listView.clear()
|
||||
searchresults.sort(cmp=self.collateSongTitles)
|
||||
for song in searchresults:
|
||||
author_list = u''
|
||||
for author in song.authors:
|
||||
@ -439,3 +441,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
if editId != 0:
|
||||
Receiver.send_message(u'service_item_update',
|
||||
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
Block a user