← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~m2j/openlp/smallfix into lp:openlp

 

m2j has proposed merging lp:~m2j/openlp/smallfix into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~m2j/openlp/smallfix/+merge/62356

This enables localized sorting algorithms for various lists.
-- 
https://code.launchpad.net/~m2j/openlp/smallfix/+merge/62356
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2011-05-25 08:32:37 +0000
+++ openlp/core/ui/thememanager.py	2011-05-25 18:53:24 +0000
@@ -29,6 +29,7 @@
 import zipfile
 import shutil
 import logging
+import locale
 
 from xml.etree.ElementTree import ElementTree, XML
 from PyQt4 import QtCore, QtGui
@@ -462,7 +463,10 @@
                     QtCore.QVariant(theme.theme_name))
                 self.configUpdated()
                 files = SettingsManager.get_files(self.settingsSection, u'.png')
-        files.sort()
+        # Sort the themes by its name considering language specific characters.
+        # lower() is needed for windows!
+        files.sort(key=lambda filename: unicode(filename).lower(),
+           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-05-24 20:47:05 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2011-05-25 18:53:24 +0000
@@ -31,6 +31,7 @@
 import logging
 import os
 import os.path
+import locale
 
 from PyQt4 import QtCore, QtGui
 
@@ -532,7 +533,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):
@@ -767,4 +768,3 @@
                 'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
             del self.manager.db_cache[importer.name]
             delete_database(self.plugin.settingsSection, importer.file)
-

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2011-05-24 20:47:05 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2011-05-25 18:53:24 +0000
@@ -26,6 +26,7 @@
 ###############################################################################
 
 import logging
+import locale
 
 from PyQt4 import QtCore, QtGui
 
@@ -359,7 +360,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:
@@ -443,7 +444,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):


Follow ups