From a821179a63add5fad7b00a8f3e670e312a0d1168 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 12 Nov 2009 00:49:55 +0000 Subject: [PATCH] A unicode fix for themes --- openlp/core/lib/themexmlhandler.py | 3 ++- openlp/core/ui/amendthemeform.py | 4 ++-- openlp/core/ui/mainwindow.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index 0501fb06f..1ffece78b 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -30,7 +30,7 @@ from xml.etree.ElementTree import ElementTree, XML from openlp.core.lib import str_to_bool blankthemexml=\ -''' +''' BlankStyle @@ -348,6 +348,7 @@ class ThemeXML(object): 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: diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 27197c5af..4e5b9cd9d 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -126,7 +126,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 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 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): (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), diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c725948a7..22e2087bc 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -676,7 +676,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): 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: