purge ICU integration from this branch

This commit is contained in:
M2j 2012-01-18 14:50:06 +01:00
parent 82250ee71f
commit 1757436853
12 changed files with 26 additions and 50 deletions

View File

@ -81,11 +81,6 @@ try:
WEBKIT_VERSION = QtWebKit.qWebKitVersion()
except AttributeError:
WEBKIT_VERSION = u'-'
try:
import icu
ICU_VERSION = u'OK'
except ImportError:
ICU_VERSION = u'-'
from openlp.core.lib import translate, SettingsManager
@ -130,8 +125,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
u'PyEnchant: %s\n' % ENCHANT_VERSION + \
u'PySQLite: %s\n' % SQLITE_VERSION + \
u'Mako: %s\n' % MAKO_VERSION + \
u'pyUNO bridge: %s\n' % UNO_VERSION + \
u'PyICU: %s\n' % ICU_VERSION
u'pyUNO bridge: %s\n' % UNO_VERSION
if platform.system() == u'Linux':
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
system = system + u'Desktop: KDE SC\n'

View File

@ -29,6 +29,7 @@ import os
import zipfile
import shutil
import logging
import locale
import re
from xml.etree.ElementTree import ElementTree, XML
@ -43,8 +44,7 @@ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
context_menu_action, context_menu_separator
from openlp.core.theme import Theme
from openlp.core.ui import FileRenameForm, ThemeForm
from openlp.core.utils import AppLocation, delete_file, \
get_filesystem_encoding, get_local_collator
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
log = logging.getLogger(__name__)
@ -459,7 +459,7 @@ class ThemeManager(QtGui.QWidget):
# Sort the themes by its name considering language specific characters.
# lower() is needed for windows!
files.sort(key=lambda filename: unicode(filename).lower(),
cmp=get_local_collator)
cmp=locale.strcoll)
# now process the file list of png files
for name in files:
# check to see file is in theme root directory

View File

@ -33,7 +33,6 @@ import re
import sys
import time
import urllib2
import locale
from datetime import datetime
from subprocess import Popen, PIPE
@ -46,18 +45,6 @@ if sys.platform != u'win32' and sys.platform != u'darwin':
except ImportError:
XDG_BASE_AVAILABLE = False
LOCALE_COLLATOR = locale.strcoll
if sys.platform == u'win32':
try:
import icu
try:
icu_locale = icu.Locale(locale.getlocale()[0])
LOCALE_COLLATOR = icu.Collator.createInstance(icu_locale).compare
except icu.InvalidArgsError:
pass
except ImportError:
pass
import openlp
from openlp.core.lib import Receiver, translate, check_directory_exists
@ -495,16 +482,10 @@ def get_uno_instance(resolver):
return resolver.resolve(u'uno:socket,host=localhost,port=2002;' \
+ u'urp;StarOffice.ComponentContext')
def get_local_collator(string1, string2):
"""
Returns a collator for locale aware string sorting.
"""
return LOCALE_COLLATOR(string1, string2)
from languagemanager import LanguageManager
from actions import ActionList
__all__ = [u'AppLocation', u'get_application_version', u'check_latest_version',
u'add_actions', u'get_filesystem_encoding', u'LanguageManager',
u'ActionList', u'get_web_page', u'get_uno_command', u'get_uno_instance',
u'get_local_collator', u'delete_file', u'clean_filename']
u'delete_file', u'clean_filename']

View File

@ -30,6 +30,7 @@ The bible import functions for OpenLP
import logging
import os
import os.path
import locale
from PyQt4 import QtCore, QtGui
@ -37,7 +38,7 @@ from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, get_local_collator
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.manager import BibleFormat
from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename
@ -521,7 +522,7 @@ class BibleImportForm(OpenLPWizard):
"""
self.webTranslationComboBox.clear()
bibles = self.web_bible_list[index].keys()
bibles.sort(cmp=get_local_collator)
bibles.sort(cmp=locale.strcoll)
self.webTranslationComboBox.addItems(bibles)
def onOsisBrowseButtonClicked(self):

View File

@ -26,6 +26,7 @@
###############################################################################
import logging
import locale
from PyQt4 import QtCore, QtGui
@ -35,7 +36,6 @@ from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
media_item_combo_box, critical_error_message_box, \
find_and_set_in_combo_box, build_icon
from openlp.core.utils import get_local_collator
from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
VerseReferenceList, get_reference_match
@ -373,7 +373,7 @@ class BibleMediaItem(MediaManagerItem):
self.advancedSecondComboBox.addItem(u'')
# Get all bibles and sort the list.
bibles = self.plugin.manager.get_bibles().keys()
bibles.sort(cmp=get_local_collator)
bibles.sort(cmp=locale.strcoll)
# Load the bibles into the combo boxes.
for bible in bibles:
if bible:
@ -481,7 +481,7 @@ class BibleMediaItem(MediaManagerItem):
book_data_temp.append(book)
book_data = book_data_temp
books = [book.name + u' ' for book in book_data]
books.sort(cmp=get_local_collator)
books.sort(cmp=locale.strcoll)
add_widget_completer(books, self.quickSearchEdit)
def onQuickVersionComboBox(self):

View File

@ -26,6 +26,7 @@
###############################################################################
import logging
import locale
from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_, func
@ -33,7 +34,6 @@ from sqlalchemy.sql import or_, func
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
check_item_selected, translate
from openlp.core.lib.ui import UiStrings
from oprnlp.core.utils import get_local_collator
from openlp.plugins.custom.forms import EditCustomForm
from openlp.plugins.custom.lib import CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide
@ -109,7 +109,7 @@ class CustomMediaItem(MediaManagerItem):
# Sort the customs by its title considering language specific
# characters. lower() is needed for windows!
custom_slides.sort(
cmp=get_local_collator, key=lambda custom: custom.title.lower())
cmp=locale.strcoll, key=lambda custom: custom.title.lower())
for custom_slide in custom_slides:
custom_name = QtGui.QListWidgetItem(custom_slide.title)
custom_name.setData(

View File

@ -27,6 +27,7 @@
import logging
import os
import locale
from PyQt4 import QtCore, QtGui
@ -34,8 +35,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
SettingsManager, translate, check_item_selected, check_directory_exists, \
Receiver, create_thumb, validate_thumb
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.utils import AppLocation, delete_file, get_images_filter, \
get_local_collator
from openlp.core.utils import AppLocation, delete_file, get_images_filter
log = logging.getLogger(__name__)
@ -120,7 +120,7 @@ class ImageMediaItem(MediaManagerItem):
self.plugin.formparent.displayProgressBar(len(images))
# Sort the themes by its filename considering language specific
# characters. lower() is needed for windows!
images.sort(cmp=get_local_collator,
images.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower())
for imageFile in images:
if not initialLoad:

View File

@ -27,6 +27,7 @@
import logging
import os
import locale
from PyQt4 import QtCore, QtGui
@ -36,7 +37,6 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
media_item_combo_box
from openlp.core.ui import Controller, Display
from openlp.core.utils import get_local_collator
log = logging.getLogger(__name__)
@ -278,7 +278,7 @@ class MediaMediaItem(MediaManagerItem):
def loadList(self, media):
# Sort the themes by its filename considering language specific
# characters. lower() is needed for windows!
media.sort(cmp=get_local_collator,
media.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower())
for track in media:
track_info = QtCore.QFileInfo(track)
@ -298,7 +298,7 @@ class MediaMediaItem(MediaManagerItem):
def getList(self, type=MediaType.Audio):
media = SettingsManager.load_list(self.settingsSection, u'media')
media.sort(cmp=get_local_collator,
media.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower())
ext = []
if type == MediaType.Audio:

View File

@ -27,6 +27,7 @@
import logging
import os
import locale
from PyQt4 import QtCore, QtGui
@ -35,7 +36,6 @@ from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
validate_thumb
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
media_item_combo_box
from openlp.core.utils import get_local_collator
from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__)
@ -168,7 +168,7 @@ class PresentationMediaItem(MediaManagerItem):
self.plugin.formparent.displayProgressBar(len(files))
# Sort the themes by its filename considering language specific
# characters. lower() is needed for windows!
files.sort(cmp=get_local_collator,
files.sort(cmp=locale.strcoll,
key=lambda filename: os.path.split(unicode(filename))[1].lower())
for file in files:
if not initialLoad:

View File

@ -28,6 +28,7 @@
The :mod:`songexportform` module provides the wizard for exporting songs to the
OpenLyrics format.
"""
import locale
import logging
from PyQt4 import QtCore, QtGui
@ -35,7 +36,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import get_local_collator
from openlp.plugins.songs.lib.db import Song
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
@ -250,7 +250,7 @@ class SongExportForm(OpenLPWizard):
# Load the list of songs.
Receiver.send_message(u'cursor_busy')
songs = self.plugin.manager.get_all_objects(Song)
songs.sort(cmp=get_local_collator, key=lambda song: song.title.lower())
songs.sort(cmp=locale.strcoll, key=lambda song: song.title.lower())
for song in songs:
# No need to export temporary songs.
if song.temporary:

View File

@ -26,6 +26,7 @@
###############################################################################
import logging
import locale
import re
import os
import shutil
@ -37,7 +38,7 @@ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, check_item_selected, PluginStatus
from openlp.core.lib.ui import UiStrings, context_menu_action, \
context_menu_separator
from openlp.core.utils import AppLocation, get_local_collator
from openlp.core.utils import AppLocation
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \
@ -239,7 +240,7 @@ class SongMediaItem(MediaManagerItem):
# Sort the songs by its title considering language specific characters.
# lower() is needed for windows!
searchresults.sort(
cmp=get_local_collator, key=lambda song: song.title.lower())
cmp=locale.strcoll, key=lambda song: song.title.lower())
for song in searchresults:
# Do not display temporary songs
if song.temporary:

View File

@ -74,7 +74,6 @@ MODULES = [
'mako',
'migrate',
'uno',
'icu',
]