openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #09084
[Merge] lp:~m2j/openlp/smallfix into lp:openlp
m2j has proposed merging lp:~m2j/openlp/smallfix into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~m2j/openlp/smallfix/+merge/62034
This enables localized sorting algorithms for various lists. The simple sort algorithm sorts lower letters after the upper ones.
Some lists (e.g. custom slides) are sorted by openlp.core.lib.db: Manager.get_all_objects(order_by_ref=somestring). This has the same problem. If I find some time I will also search for a nice solution in that case.
--
https://code.launchpad.net/~m2j/openlp/smallfix/+merge/62034
Your team OpenLP Core is requested to review the proposed merge of lp:~m2j/openlp/smallfix into lp:openlp.
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2011-05-20 15:00:27 +0000
+++ openlp/core/ui/thememanager.py 2011-05-23 20:53:24 +0000
@@ -28,6 +28,7 @@
import zipfile
import shutil
import logging
+import locale
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui
@@ -461,7 +462,7 @@
QtCore.QVariant(theme.theme_name))
self.configUpdated()
files = SettingsManager.get_files(self.settingsSection, u'.png')
- files.sort()
+ files.sort(key=lambda filename: unicode(filename), cmp=locale.strcoll)
# now process the file list of png files
for name in files:
# check to see file is in theme root directory
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2011-04-15 21:43:59 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2011-05-23 20:53:24 +0000
@@ -30,6 +30,7 @@
import logging
import os
import os.path
+import locale
from PyQt4 import QtCore, QtGui
@@ -531,7 +532,7 @@
"""
self.webTranslationComboBox.clear()
bibles = self.web_bible_list[index].keys()
- bibles.sort()
+ bibles.sort(cmp=locale.strcoll)
self.webTranslationComboBox.addItems(bibles)
def onOsisBrowseButtonClicked(self):
@@ -765,4 +766,4 @@
self.progressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
del self.manager.db_cache[importer.name]
- delete_database(self.plugin.settingsSection, importer.file)
\ No newline at end of file
+ delete_database(self.plugin.settingsSection, importer.file)
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2011-05-17 18:48:04 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2011-05-23 20:53:24 +0000
@@ -25,6 +25,7 @@
###############################################################################
import logging
+import locale
from PyQt4 import QtCore, QtGui
@@ -358,7 +359,7 @@
self.advancedSecondComboBox.addItem(u'')
# Get all bibles and sort the list.
bibles = self.parent.manager.get_bibles().keys()
- bibles.sort()
+ bibles.sort(cmp=locale.strcoll)
# Load the bibles into the combo boxes.
for bible in bibles:
if bible:
@@ -442,7 +443,7 @@
if bible:
book_data = bibles[bible].get_books()
books = [book.name + u' ' for book in book_data]
- books.sort()
+ books.sort(cmp=locale.strcoll)
add_widget_completer(books, self.quickSearchEdit)
def onImportClick(self):
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2011-05-22 01:29:09 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2011-05-23 20:53:24 +0000
@@ -229,7 +229,8 @@
def displayResultsSong(self, searchresults):
log.debug(u'display results Song')
self.listView.clear()
- searchresults.sort(cmp=self.collateSongTitles)
+ searchresults.sort(key=lambda song: unicode(song.title),
+ cmp=locale.strcoll)
for song in searchresults:
author_list = [author.display_name for author in song.authors]
song_title = unicode(song.title)
@@ -475,13 +476,6 @@
Receiver.send_message(u'service_item_update',
u'%s:%s' % (editId, item._uuid))
- def collateSongTitles(self, song_1, song_2):
- """
- Locale aware collation of song titles
- """
- return locale.strcoll(unicode(song_1.title.lower()),
- unicode(song_2.title.lower()))
-
def search(self, string):
"""
Search for some songs
Follow ups