← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


Remove unused import

Apply gushie's encode/decode idea to fix unicode handling in songs and themes.
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/14768
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/songxmlhandler.py'
--- openlp/core/lib/songxmlhandler.py	2009-10-31 10:19:30 +0000
+++ openlp/core/lib/songxmlhandler.py	2009-11-12 01:05:24 +0000
@@ -134,7 +134,8 @@
             The XML of the song to be parsed.
         """
         try:
-            self.song_xml = ElementTree(element=XML(xml))
+            self.song_xml = ElementTree(
+                element=XML(unicode(xml).encode('unicode-escape')))
         except:
             log.exception(u'Invalid xml %s', xml)
 
@@ -147,7 +148,8 @@
         verse_list = []
         for element in iter:
             if element.tag == u'verse':
-                verse_list.append([element.attrib, element.text])
+                verse_list.append([element.attrib,
+                    unicode(element.text).decode('unicode-escape')])
         return verse_list
 
     def dump_xml(self):

=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py	2009-11-03 18:14:25 +0000
+++ openlp/core/lib/themexmlhandler.py	2009-11-12 01:05:24 +0000
@@ -30,7 +30,7 @@
 from openlp.core.lib import str_to_bool
 
 blankthemexml=\
-'''<?xml version="1.0" encoding="iso-8859-1"?>
+'''<?xml version="1.0" encoding="utf-8"?>
  <theme version="1.0">
    <name>BlankStyle</name>
    <background mode="transparent"/>
@@ -348,6 +348,7 @@
         iter = theme_xml.getiterator()
         master = u''
         for element in iter:
+            element.text = unicode(element.text).decode('unicode-escape')
             if len(element.getchildren()) > 0:
                 master = element.tag + u'_'
             else:

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2009-11-07 00:00:36 +0000
+++ openlp/core/ui/amendthemeform.py	2009-11-12 01:05:24 +0000
@@ -126,7 +126,7 @@
     def accept(self):
         new_theme = ThemeXML()
         theme_name = unicode(self.ThemeNameEdit.displayText())
-        new_theme.new_document(theme_name)
+        new_theme.new_document(theme_name.encode('unicode-escape'))
         save_from = None
         save_to = None
         if self.theme.background_mode == u'transparent':
@@ -144,7 +144,7 @@
                 (path, filename) = \
                     os.path.split(unicode(self.theme.background_filename))
                 new_theme.add_background_image(filename)
-                save_to= os.path.join(self.path, theme_name, filename )
+                save_to = os.path.join(self.path, theme_name, filename)
                 save_from = self.theme.background_filename
 
         new_theme.add_font(unicode(self.theme.font_main_name),

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2009-11-10 06:13:59 +0000
+++ openlp/core/ui/maindisplay.py	2009-11-12 01:05:24 +0000
@@ -28,7 +28,7 @@
 from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon
 
-from openlp.core.lib import Receiver, str_to_bool
+from openlp.core.lib import Receiver
 
 class DisplayWidget(QtGui.QWidget):
     """

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2009-11-09 05:58:45 +0000
+++ openlp/core/ui/mainwindow.py	2009-11-12 01:05:24 +0000
@@ -679,7 +679,8 @@
         self.setWindowTitle(title)
 
     def defaultThemeChanged(self, theme):
-        self.DefaultThemeLabel.setText(self.defaultThemeText + theme)
+        self.DefaultThemeLabel.setText(
+            u'%s %s' % (self.defaultThemeText, theme))
 
     def toggleMediaManager(self, visible):
         if self.MediaManagerDock.isVisible() != visible:

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2009-11-04 18:21:08 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2009-11-12 01:05:24 +0000
@@ -291,7 +291,7 @@
         service_item.editId = item_id
         service_item.verse_order = song.verse_order
         if song.lyrics.startswith(u'<?xml version='):
-            songXML=SongXMLParser(song.lyrics)
+            songXML = SongXMLParser(song.lyrics)
             verseList = songXML.get_verses()
             for verse in verseList:
                 if verse[1]:


Follow ups