← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  Jon Tibble (meths)


A lot of small changes and fixes. I integrated also a change in the verse order algorithm. As I didn't knew the problem a few days ago, Tim should look at the changes in plugins/songs/lib/mediaitem.py
-- 
https://code.launchpad.net/~m2j/openlp/work/+merge/27326
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2010-06-05 13:28:53 +0000
+++ openlp/core/lib/__init__.py	2010-06-11 07:18:28 +0000
@@ -80,9 +80,9 @@
     ``stringvalue``
         The string value to examine and convert to a boolean type.
     """
-    if stringvalue is True or stringvalue is False:
+    if isinstance(stringvalue, bool):
         return stringvalue
-    return stringvalue.strip().lower() in (u'true', u'yes', u'y')
+    return unicode(stringvalue).strip().lower() in (u'true', u'yes', u'y')
 
 def build_icon(icon):
     """

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2010-06-09 17:09:32 +0000
+++ openlp/core/lib/mediamanageritem.py	2010-06-11 07:18:28 +0000
@@ -344,7 +344,7 @@
         filelist = []
         while count < self.ListView.count():
             bitem = self.ListView.item(count)
-            filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
+            filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
             filelist.append(filename)
             count += 1
         return filelist

=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2010-06-09 17:09:32 +0000
+++ openlp/core/lib/renderer.py	2010-06-11 07:18:28 +0000
@@ -468,7 +468,7 @@
                     self._get_extent_and_render(line, footer,
                         tlcorner=(x + display_shadow_size,
                             y + display_shadow_size),
-                            draw=True, color = self._theme.display_shadow_color)
+                            draw=True, color=self._theme.display_shadow_color)
                 self._get_extent_and_render(line, footer, tlcorner=(x, y),
                         draw=True, outline_size=display_outline_size)
             y += h

=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py	2010-06-06 22:30:11 +0000
+++ openlp/core/ui/aboutform.py	2010-06-11 07:18:28 +0000
@@ -44,8 +44,8 @@
         about_text = about_text.replace(u'<version>',
             self.applicationVersion[u'version'])
         if self.applicationVersion[u'build']:
-            build_text = u' %s %s' % (translate(u'AboutForm', u'build'),
-                self.applicationVersion[u'build'])
+            build_text = unicode(translate(u'AboutForm', u' build %s')) % \
+                self.applicationVersion[u'build']
         else:
             build_text = u''
         about_text = about_text.replace(u'<revision>', build_text)

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2010-06-09 17:09:32 +0000
+++ openlp/core/ui/amendthemeform.py	2010-06-11 07:18:28 +0000
@@ -155,7 +155,7 @@
                     self.theme.background_direction)
             else:
                 filename = \
-                    os.path.split(unicode(self.theme.background_filename))[0]
+                    os.path.split(unicode(self.theme.background_filename))[1]
                 new_theme.add_background_image(filename)
                 save_to = os.path.join(self.path, theme_name, filename)
                 save_from = self.theme.background_filename

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-06-06 22:30:11 +0000
+++ openlp/core/ui/mainwindow.py	2010-06-11 07:18:28 +0000
@@ -452,8 +452,8 @@
             translate(u'MainWindow', u'Choose System language, if available'))
         for item in self.LanguageGroup.actions():
             item.setText(item.objectName())
-            item.setStatusTip(translate(u'MainWindow',
-                u'Set the interface language to %1').arg(item.objectName()))
+            item.setStatusTip(unicode(translate(u'MainWindow',
+                u'Set the interface language to %s')) % item.objectName())
         self.ToolsAddToolItem.setText(translate(u'MainWindow', u'Add &Tool...'))
         self.ToolsAddToolItem.setStatusTip(
             translate(u'MainWindow', 
@@ -851,5 +851,5 @@
         if filename and filename not in self.recentFiles:
             self.recentFiles.insert(0, QtCore.QString(filename))
             while self.recentFiles.count() > recentFileCount:
-                self.recentFiles.pop()
+                self.recentFiles.removeLast()
 

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2010-03-21 23:58:01 +0000
+++ openlp/core/ui/pluginform.py	2010-06-11 07:18:28 +0000
@@ -27,7 +27,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib.plugin import PluginStatus
+from openlp.core.lib import PluginStatus, translate
 from plugindialog import Ui_PluginViewDialog
 
 log = logging.getLogger(__name__)
@@ -63,14 +63,14 @@
             # sometimes when it's loaded from the config, it isn't cast to int.
             plugin.status = int(plugin.status)
             # Set the little status text in brackets next to the plugin name.
-            status_text = 'Inactive'
+            status_text = unicode(translate(u'PluginForm', u'%s (Inactive)'))
             if plugin.status == PluginStatus.Active:
-                status_text = 'Active'
+                status_text = unicode(translate(u'PluginForm', u'%s (Active)'))
             elif plugin.status == PluginStatus.Inactive:
-                status_text = 'Inactive'
+                status_text = unicode(translate(u'PluginForm', u'%s (Inactive)'))
             elif plugin.status == PluginStatus.Disabled:
-                status_text = 'Disabled'
-            item.setText(u'%s (%s)' % (plugin.name, status_text))
+                status_text = unicode(translate(u'PluginForm', u'%s (Disabled)'))
+            item.setText(status_text % plugin.name)
             # If the plugin has an icon, set it!
             if plugin.icon:
                 item.setIcon(plugin.icon)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2010-06-09 17:09:32 +0000
+++ openlp/core/ui/servicemanager.py	2010-06-11 07:18:28 +0000
@@ -597,11 +597,11 @@
                             path_from = unicode(os.path.join(
                                 frame[u'path'],
                                 frame[u'title']))
-                            zip.write(path_from)
+                            zip.write(path_from.encode(u'utf-8'))
                 file = open(servicefile, u'wb')
                 cPickle.dump(service, file)
                 file.close()
-                zip.write(servicefile)
+                zip.write(servicefile.encode(u'utf-8'))
             except IOError:
                 log.exception(u'Failed to save service to disk')
             finally:
@@ -667,7 +667,18 @@
             try:
                 zip = zipfile.ZipFile(unicode(filename))
                 for file in zip.namelist():
-                    osfile = unicode(QtCore.QDir.toNativeSeparators(file))
+                    try:
+                        ucsfile = file.decode(u'utf-8')
+                    except UnicodeDecodeError:
+                        QtGui.QMessageBox.critical(
+                            self, translate(u'ServiceManager', u'Error'),
+                            translate(u'ServiceManager',
+                                u'File is not a valid service.\n'
+                                u'The content encoding is not UTF-8.'))
+                        log.exception(u'Filename "%s" is not valid UTF-8' % \
+                            file.decode(u'utf-8', u'replace'))
+                        continue
+                    osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
                     names = osfile.split(os.path.sep)
                     file_path = os.path.join(self.servicePath,
                         names[len(names) - 1])
@@ -677,22 +688,29 @@
                     file_to.close()
                     if file_path.endswith(u'osd'):
                         p_file = file_path
-                file_to = open(p_file, u'r')
-                items = cPickle.load(file_to)
-                file_to.close()
-                self.onNewService()
-                for item in items:
-                    serviceitem = ServiceItem()
-                    serviceitem.RenderManager = self.parent.RenderManager
-                    serviceitem.set_from_service(item, self.servicePath)
-                    self.validateItem(serviceitem)
-                    self.addServiceItem(serviceitem)
-                try:
-                    if os.path.isfile(p_file):
-                        os.remove(p_file)
-                except (IOError, OSError):
-                    log.exception(u'Failed to remove osd file')
-            except IOError:
+                if 'p_file' in locals():
+                    file_to = open(p_file, u'r')
+                    items = cPickle.load(file_to)
+                    file_to.close()
+                    self.onNewService()
+                    for item in items:
+                        serviceitem = ServiceItem()
+                        serviceitem.RenderManager = self.parent.RenderManager
+                        serviceitem.set_from_service(item, self.servicePath)
+                        self.validateItem(serviceitem)
+                        self.addServiceItem(serviceitem)
+                    try:
+                        if os.path.isfile(p_file):
+                            os.remove(p_file)
+                    except (IOError, OSError):
+                        log.exception(u'Failed to remove osd file')
+                else:
+                    QtGui.QMessageBox.critical(
+                        self, translate(u'ServiceManager', u'Error'),
+                        translate(u'ServiceManager',
+                            u'File is not a valid service.'))
+                    log.exception(u'File contains no service data')
+            except (IOError, NameError):
                 log.exception(u'Problem loading a service file')
             finally:
                 if file_to:

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2010-06-09 17:09:32 +0000
+++ openlp/core/ui/slidecontroller.py	2010-06-11 07:18:28 +0000
@@ -562,8 +562,7 @@
                 if self.isLive and frame[u'verseTag'] is not None:
                     if tag1 not in self.slideList:
                         self.slideList[tag1] = framenumber
-                        self.SongMenu.menu().addAction(
-                            translate(u'SlideController', u'%s'%tag1),
+                        self.SongMenu.menu().addAction(tag1,
                             self.onSongBarHandler)
                 item.setText(frame[u'text'])
             else:

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2010-06-10 13:20:43 +0000
+++ openlp/core/ui/thememanager.py	2010-06-11 07:18:28 +0000
@@ -36,7 +36,7 @@
 from openlp.core.lib import OpenLPToolbar, contextMenuAction, \
     ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
     contextMenuSeparator, SettingsManager, translate
-from openlp.core.utils import AppLocation
+from openlp.core.utils import AppLocation, get_filesystem_encoding
 
 log = logging.getLogger(__name__)
 
@@ -131,8 +131,8 @@
                 self.ThemeListWidget.item(count).setText(newName)
             #Set the new name
             if themeName == newName:
-                name = u'%s (%s)' % (newName,
-                    translate(u'ThemeManager', u'default'))
+                name = unicode(translate(u'ThemeManager', u'%s (default)')) % \
+                    newName
                 self.ThemeListWidget.item(count).setText(name)
 
     def changeGlobalFromScreen(self, index = -1):
@@ -149,8 +149,8 @@
             if count == selected_row:
                 self.global_theme = unicode(
                     self.ThemeListWidget.item(count).text())
-                name = u'%s (%s)' % (self.global_theme, 
-                    translate(u'ThemeManager', u'default'))
+                name = unicode(translate(u'ThemeManager', u'%s (default)')) % \
+                    self.global_theme
                 self.ThemeListWidget.item(count).setText(name)
                 QtCore.QSettings().setValue(
                     self.settingsSection + u'/global theme',
@@ -211,7 +211,9 @@
                 try:
                     os.remove(os.path.join(self.path, th))
                     os.remove(os.path.join(self.thumbPath, th))
-                    shutil.rmtree(os.path.join(self.path, theme))
+                    encoding = get_filesystem_encoding()
+                    shutil.rmtree(
+                        os.path.join(self.path, theme).encode(encoding))
                 except OSError:
                     #if not present do not worry
                     pass
@@ -245,8 +247,8 @@
                 for files in os.walk(source):
                     for name in files[2]:
                         zip.write(
-                            os.path.join(source, name),
-                            os.path.join(theme, name))
+                            os.path.join(source, name).encode(u'utf-8'),
+                            os.path.join(theme, name).encode(u'utf-8'))
                 QtGui.QMessageBox.information(self,
                     translate(u'ThemeManager', u'Theme Exported'),
                     translate(u'ThemeManager',
@@ -291,8 +293,8 @@
                 if os.path.exists(theme):
                     textName = os.path.splitext(name)[0]
                     if textName == self.global_theme:
-                        name = u'%s (%s)' % (textName,
-                            translate(u'ThemeManager', u'default'))
+                        name = unicode(translate(u'ThemeManager',
+                            u'%s (default)')) % textName
                     else:
                         name = textName
                     thumb = os.path.join(self.thumbPath, u'%s.png' % textName)
@@ -345,7 +347,17 @@
             filexml = None
             themename = None
             for file in zip.namelist():
-                osfile = unicode(QtCore.QDir.toNativeSeparators(file))
+                try:
+                    ucsfile = file.decode(u'utf-8')
+                except UnicodeDecodeError:
+                    QtGui.QMessageBox.critical(
+                        self, translate(u'ThemeManager', u'Error'),
+                        translate(u'ThemeManager', u'File is not a valid '
+                            u'theme.\nThe content encoding is not UTF-8.'))
+                    log.exception(u'Filename "%s" is not valid UTF-8' % \
+                        file.decode(u'utf-8', u'replace'))
+                    continue
+                osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
                 theme_dir = None
                 if osfile.endswith(os.path.sep):
                     theme_dir = os.path.join(dir, osfile)
@@ -363,7 +375,7 @@
                             if not os.path.exists(theme_dir):
                                 os.mkdir(os.path.join(dir, names[0]))
                         xml_data = zip.read(file)
-                        if os.path.splitext(file)[1].lower() in [u'.xml']:
+                        if os.path.splitext(ucsfile)[1].lower() in [u'.xml']:
                             if self.checkVersion1(xml_data):
                                 # upgrade theme xml
                                 filexml = self.migrateVersion122(xml_data)
@@ -374,8 +386,14 @@
                         else:
                             outfile = open(fullpath, u'wb')
                             outfile.write(zip.read(file))
-            self.generateAndSaveImage(dir, themename, filexml)
-        except IOError:
+            if filexml:
+                self.generateAndSaveImage(dir, themename, filexml)
+            else:
+                QtGui.QMessageBox.critical(
+                    self, translate(u'ThemeManager', u'Error'),
+                    translate(u'ThemeManager', u'File is not a valid theme.'))
+                log.exception(u'Theme file dosen\'t contain XML data %s' % filename)
+        except (IOError, NameError):
             QtGui.QMessageBox.critical(
                 self, translate(u'ThemeManager', u'Error'),
                 translate(u'ThemeManager', u'File is not a valid theme.'))
@@ -477,7 +495,10 @@
                     outfile.close()
             if image_from and image_from != image_to:
                 try:
-                    shutil.copyfile(image_from, image_to)
+                    encoding = get_filesystem_encoding()
+                    shutil.copyfile(
+                        unicode(image_from).encode(encoding),
+                        unicode(image_to).encode(encoding))
                 except IOError:
                     log.exception(u'Failed to save theme image')
             self.generateAndSaveImage(self.path, name, theme_xml)

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2010-05-25 23:07:50 +0000
+++ openlp/core/utils/__init__.py	2010-06-11 07:18:28 +0000
@@ -146,27 +146,6 @@
                 log.exception(u'Reason for failure: %s', e.reason)
     return version_string
 
-def string_to_unicode(string):
-    """
-    Converts a QString to a Python unicode object.
-    """
-    if isinstance(string, QtCore.QString):
-        string = unicode(string.toUtf8(), u'utf8')
-    return string
-
-def variant_to_unicode(variant):
-    """
-    Converts a QVariant to a Python unicode object.
-
-    ``variant``
-        The QVariant instance to convert to unicode.
-    """
-    if isinstance(variant, QtCore.QVariant):
-        string = variant.toString()
-    if not isinstance(string, unicode):
-        string = string_to_unicode(string)
-    return string
-
 def add_actions(target, actions):
     """
     Adds multiple actions to a menu or toolbar in one command.
@@ -184,7 +163,17 @@
         else:
             target.addAction(action)
 
+def get_filesystem_encoding():
+    """
+    Returns the name of the encoding used to convert Unicode filenames into
+    system file names.
+    """
+    encoding = sys.getfilesystemencoding()
+    if encoding is None:
+        encoding = sys.getdefaultencoding()
+    return encoding
+
 from languagemanager import LanguageManager
 
 __all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
-    u'LanguageManager']
+    u'get_filesystem_encoding', u'LanguageManager']

=== modified file 'openlp/plugins/bibles/forms/importwizardform.py'
--- openlp/plugins/bibles/forms/importwizardform.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/bibles/forms/importwizardform.py	2010-06-11 07:18:28 +0000
@@ -32,7 +32,7 @@
 
 from bibleimportwizard import Ui_BibleImportWizard
 from openlp.core.lib import Receiver, SettingsManager, translate
-from openlp.core.utils import AppLocation, variant_to_unicode
+from openlp.core.utils import AppLocation
 from openlp.plugins.bibles.lib.manager import BibleFormat
 
 log = logging.getLogger(__name__)
@@ -167,9 +167,9 @@
             return True
         elif self.currentId() == 2:
             # License details
-            license_version = variant_to_unicode(self.field(u'license_version'))
-            license_copyright = variant_to_unicode(
-                self.field(u'license_copyright'))
+            license_version = unicode(self.field(u'license_version').toString())
+            license_copyright = \
+                unicode(self.field(u'license_copyright').toString())
             if license_version == u'':
                 QtGui.QMessageBox.critical(self,
                     translate(u'BiblesPlugin.ImportWizardForm', 
@@ -391,37 +391,35 @@
 
     def performImport(self):
         bible_type = self.field(u'source_format').toInt()[0]
-        license_version = variant_to_unicode(self.field(u'license_version'))
-        license_copyright = variant_to_unicode(self.field(u'license_copyright'))
-        license_permission = variant_to_unicode(
-            self.field(u'license_permission'))
+        license_version = unicode(self.field(u'license_version').toString())
+        license_copyright = unicode(self.field(u'license_copyright').toString())
+        license_permission = \
+            unicode(self.field(u'license_permission').toString())
         importer = None
         if bible_type == BibleFormat.OSIS:
             # Import an OSIS bible
             importer = self.manager.import_bible(BibleFormat.OSIS,
                 name=license_version,
-                filename=variant_to_unicode(self.field(u'osis_location'))
+                filename=unicode(self.field(u'osis_location').toString())
             )
         elif bible_type == BibleFormat.CSV:
             # Import a CSV bible
             importer = self.manager.import_bible(BibleFormat.CSV,
                 name=license_version,
-                booksfile=variant_to_unicode(self.field(u'csv_booksfile')),
-                versefile=variant_to_unicode(self.field(u'csv_versefile'))
+                booksfile=unicode(self.field(u'csv_booksfile').toString()),
+                versefile=unicode(self.field(u'csv_versefile').toString())
             )
         elif bible_type == BibleFormat.OpenSong:
             # Import an OpenSong bible
             importer = self.manager.import_bible(BibleFormat.OpenSong,
                 name=license_version,
-                filename=variant_to_unicode(self.field(u'opensong_file'))
+                filename=unicode(self.field(u'opensong_file').toString())
             )
         elif bible_type == BibleFormat.WebDownload:
             # Import a bible from the web
             self.ImportProgressBar.setMaximum(1)
             download_location = self.field(u'web_location').toInt()[0]
-            bible_version = self.BibleComboBox.currentText()
-            if not isinstance(bible_version, unicode):
-                bible_version = unicode(bible_version, u'utf8')
+            bible_version = unicode(self.BibleComboBox.currentText())
             if download_location == WebDownload.Crosswalk:
                 bible = \
                     self.web_bible_list[WebDownload.Crosswalk][bible_version]
@@ -433,10 +431,10 @@
                 name=license_version,
                 download_source=WebDownload.get_name(download_location),
                 download_name=bible,
-                proxy_server=variant_to_unicode(self.field(u'proxy_server')),
-                proxy_username=variant_to_unicode(
-                    self.field(u'proxy_username')),
-                proxy_password=variant_to_unicode(self.field(u'proxy_password'))
+                proxy_server=unicode(self.field(u'proxy_server').toString()),
+                proxy_username=\
+                    unicode(self.field(u'proxy_username').toString()),
+                proxy_password=unicode(self.field(u'proxy_password').toString())
             )
         success = importer.do_import()
         if success:

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2010-06-11 07:18:28 +0000
@@ -454,7 +454,7 @@
     def onQuickSearchButton(self):
         log.debug(u'Quick Search Button pressed')
         bible = unicode(self.QuickVersionComboBox.currentText())
-        text = unicode(self.QuickSearchEdit.displayText())
+        text = unicode(self.QuickSearchEdit.text())
         if self.ClearQuickSearchComboBox.currentIndex() == 0:
             self.ListView.clear()
             self.lastReference = []

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2010-06-11 07:18:28 +0000
@@ -120,12 +120,13 @@
         if items:
             for item in items:
                 text = self.ListView.item(item.row())
-                try:
-                    os.remove(
-                        os.path.join(self.servicePath, unicode(text.text())))
-                except OSError:
-                    #if not present do not worry
-                    pass
+                if text:
+                    try:
+                        os.remove(
+                            os.path.join(self.servicePath, unicode(text.text())))
+                    except OSError:
+                        #if not present do not worry
+                        pass
                 self.ListView.takeItem(item.row())
                 SettingsManager.set_list(self.settingsSection,
                     self.settingsSection, self.getFileList())
@@ -157,7 +158,7 @@
             service_item.add_capability(ItemCapabilities.AllowsAdditions)
             for item in items:
                 bitem = self.ListView.item(item.row())
-                filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
+                filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
                 frame = QtGui.QImage(unicode(filename))
                 (path, name) = os.path.split(filename)
                 service_item.add_from_image(path, name, frame)
@@ -174,7 +175,7 @@
         items = self.ListView.selectedIndexes()
         for item in items:
             bitem = self.ListView.item(item.row())
-            filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
+            filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
             frame = QtGui.QImage(unicode(filename))
             self.parent.maindisplay.addImageWithText(frame)
 

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2010-06-11 07:18:28 +0000
@@ -112,7 +112,7 @@
             items = self.ListView.selectedIndexes()
             for item in items:
                 bitem = self.ListView.item(item.row())
-                filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
+                filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
                 Receiver.send_message(u'videodisplay_background', filename)
 
     def generateSlideData(self, service_item, item=None):
@@ -120,7 +120,7 @@
             item = self.ListView.currentItem()
             if item is None:
                 return False
-        filename = unicode((item.data(QtCore.Qt.UserRole)).toString())
+        filename = unicode(item.data(QtCore.Qt.UserRole).toString())
         service_item.title = unicode(
             translate(u'MediaPlugin.MediaItem', u'Media'))
         service_item.add_capability(ItemCapabilities.RequiresMedia)

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2010-06-06 22:30:11 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2010-06-11 07:18:28 +0000
@@ -180,7 +180,7 @@
             self.ListView.takeItem(row)
             SettingsManager.set_list(self.settingsSection,
                 self.settingsSection, self.getFileList())
-            filepath = unicode((item.data(QtCore.Qt.UserRole)).toString())
+            filepath = unicode(item.data(QtCore.Qt.UserRole).toString())
             #not sure of this has errors
             #John please can you look at .
             for cidx in self.controllers:
@@ -198,7 +198,7 @@
         if shortname:
             for item in items:
                 bitem = self.ListView.item(item.row())
-                filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
+                filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
                 if shortname == self.Automatic:
                     service_item.shortname = self.findControllerByType(filename)
                     if not service_item.shortname:

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-06-11 07:18:28 +0000
@@ -291,7 +291,7 @@
         rowLabel = []
         for row in range(0, self.VerseListWidget.rowCount()):
             item = self.VerseListWidget.item(row, 0)
-            data = unicode((item.data(QtCore.Qt.UserRole)).toString())
+            data = unicode(item.data(QtCore.Qt.UserRole).toString())
             bit = data.split(u':')
             rowTag = u'%s\n%s' % (bit[0][0:1], bit[1])
             rowLabel.append(rowTag)
@@ -382,7 +382,7 @@
         item = self.VerseListWidget.currentItem()
         if item:
             tempText = item.text()
-            verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
+            verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
             self.verse_form.setVerse(tempText, True, verseId)
             if self.verse_form.exec_():
                 afterText, verse, subVerse = self.verse_form.getVerse()
@@ -413,7 +413,7 @@
         if self.VerseListWidget.rowCount() > 0:
             for row in range(0, self.VerseListWidget.rowCount()):
                 item = self.VerseListWidget.item(row, 0)
-                field = unicode((item.data(QtCore.Qt.UserRole)).toString())
+                field = unicode(item.data(QtCore.Qt.UserRole).toString())
                 verse_list += u'---[%s]---\n' % field
                 verse_list += item.text()
                 verse_list += u'\n'
@@ -504,7 +504,7 @@
     def onCopyrightInsertButtonTriggered(self):
         text = self.CopyrightEditItem.text()
         pos = self.CopyrightEditItem.cursorPosition()
-        text = text[:pos] + u'©' + text[pos:]
+        text = text[:pos] + u'\xa9' + text[pos:]
         self.CopyrightEditItem.setText(text)
         self.CopyrightEditItem.setFocus()
         self.CopyrightEditItem.setCursorPosition(pos + 1)
@@ -562,7 +562,7 @@
             text = u' '
             for i in range (0, self.VerseListWidget.rowCount()):
                 item = self.VerseListWidget.item(i, 0)
-                verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
+                verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
                 bits = verseId.split(u':')
                 sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
                 text = text + unicode(self.VerseListWidget.item(i, 0).text()) \

=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/songs/forms/editverseform.py	2010-06-11 07:18:28 +0000
@@ -104,7 +104,7 @@
             verse_type = match.group(1)
             verse_number = int(match.group(2))
             verse_type_index = VerseType.from_string(verse_type)
-            if verse_type_index:
+            if verse_type_index is not None:
                 self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
                 self.VerseNumberBox.setValue(verse_number)
 
@@ -112,8 +112,9 @@
         tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
         if single:
             verse_type, verse_number = tag.split(u':')
-            self.VerseTypeComboBox.setCurrentIndex(
-                VerseType.from_string(verse_type))
+            verse_type_index = VerseType.from_string(verse_type)
+            if verse_type_index is not None:
+                self.VerseTypeComboBox.setCurrentIndex(verse_type_index)
             self.VerseNumberBox.setValue(int(verse_number))
             self.InsertButton.setVisible(False)
         else:

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2010-06-06 14:22:00 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2010-06-11 07:18:28 +0000
@@ -29,7 +29,7 @@
 
 from songimportwizard import Ui_SongImportWizard
 from openlp.core.lib import Receiver, SettingsManager, translate
-#from openlp.core.utils import AppLocation, variant_to_unicode
+#from openlp.core.utils import AppLocation
 from openlp.plugins.songs.lib.manager import SongFormat
 
 log = logging.getLogger(__name__)
@@ -203,20 +203,20 @@
 #            # Import an OSIS bible
 #            importer = self.manager.import_bible(BibleFormat.OSIS,
 #                name=license_version,
-#                filename=variant_to_unicode(self.field(u'osis_location'))
+#                filename=unicode(self.field(u'osis_location').toString())
 #            )
 #        elif bible_type == BibleFormat.CSV:
 #            # Import a CSV bible
 #            importer = self.manager.import_bible(BibleFormat.CSV,
 #                name=license_version,
-#                booksfile=variant_to_unicode(self.field(u'csv_booksfile')),
-#                versefile=variant_to_unicode(self.field(u'csv_versefile'))
+#                booksfile=unicode(self.field(u'csv_booksfile').toString()),
+#                versefile=unicode(self.field(u'csv_versefile').toString())
 #            )
 #        elif bible_type == BibleFormat.OpenSong:
 #            # Import an OpenSong bible
 #            importer = self.manager.import_bible(BibleFormat.OpenSong,
 #                name=license_version,
-#                filename=variant_to_unicode(self.field(u'opensong_file'))
+#                filename=unicode(self.field(u'opensong_file').toString())
 #            )
 #        elif bible_type == BibleFormat.WebDownload:
 #            # Import a bible from the web
@@ -234,9 +234,9 @@
 #                name=license_version,
 #                download_source=WebDownload.get_name(download_location),
 #                download_name=bible,
-#                proxy_server=variant_to_unicode(self.field(u'proxy_server')),
-#                proxy_username=variant_to_unicode(self.field(u'proxy_username')),
-#                proxy_password=variant_to_unicode(self.field(u'proxy_password'))
+#                proxy_server=unicode(self.field(u'proxy_server').toString()),
+#                proxy_username=unicode(self.field(u'proxy_username').toString()),
+#                proxy_password=unicode(self.field(u'proxy_password').toString())
 #            )
 #        success = importer.do_import()
 #        if success:

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2010-06-08 15:38:09 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2010-06-11 07:18:28 +0000
@@ -341,8 +341,8 @@
                     if len(order) == 0:
                         break
                     for verse in verseList:
-                        if verse[0][u'label'] == order[1:] and \
-                            verse[0][u'type'][0] == order[0]:
+                        if verse[0][u'type'][0] == order[0] and \
+                            (verse[0][u'label'] == order[1:] or not order[1:]):
                             verseTag = u'%s:%s' % \
                                 (verse[0][u'type'], verse[0][u'label'])
                             service_item.add_from_text\

=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py	2010-06-06 22:30:11 +0000
+++ openlp/plugins/songs/lib/songimport.py	2010-06-11 07:18:28 +0000
@@ -66,7 +66,7 @@
         self.copyright_string = unicode(QtGui.QApplication.translate( \
             u'SongsPlugin.SongImport', u'copyright'))
         self.copyright_symbol = unicode(QtGui.QApplication.translate( \
-            u'SongsPlugin.SongImport', u'©'))
+            u'SongsPlugin.SongImport', u'\xa9'))
 
     @staticmethod
     def process_songs_text(manager, text):


Follow ups