Bring this branch up to date with trunk

This commit is contained in:
Raoul Snyman 2009-09-13 19:55:52 +02:00
commit 9684e696ca
2 changed files with 15 additions and 12 deletions

View File

@ -201,7 +201,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
#self.theme.background_mode
self.theme.background_startColor = theme.background_startColor.strip()
#self.theme.background_type
self.theme.display_display = theme.display_display.strip()
if theme.display_display:
self.theme.display_display = theme.display_display.strip()
self.theme.display_horizontalAlign = \
theme.display_horizontalAlign.strip()
self.theme.display_outline = str_to_bool(theme.display_outline)

View File

@ -33,9 +33,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.ui import AmendThemeForm, ServiceManager
from openlp.core.theme import Theme
from openlp.core.lib import PluginConfig, \
OpenLPToolbar, ThemeXML, Renderer, translate, \
file_to_xml, buildIcon, Receiver
from openlp.core.lib import PluginConfig, OpenLPToolbar, ThemeXML, Renderer, \
translate, str_to_bool, file_to_xml, buildIcon, Receiver
from openlp.core.utils import ConfigHelper
class ThemeManager(QtGui.QWidget):
@ -140,9 +139,8 @@ class ThemeManager(QtGui.QWidget):
def onEditTheme(self):
item = self.ThemeListWidget.currentItem()
if item is not None:
self.amendThemeForm.setTheme(self.getThemeData(
item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.loadTheme()
self.amendThemeForm.loadTheme(
unicode(item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.exec_()
def onDeleteTheme(self):
@ -230,21 +228,25 @@ class ThemeManager(QtGui.QWidget):
def getThemeData(self, themename):
log.debug(u'getthemedata for theme %s', themename)
xml_file = os.path.join(self.path, unicode(themename), unicode(themename) + u'.xml')
xml_file = os.path.join(self.path, unicode(themename),
unicode(themename) + u'.xml')
try:
xml = file_to_xml(xml_file)
except:
newtheme = ThemeXML()
newtheme.new_document(u'New Theme')
newtheme.add_background_solid(unicode(u'#000000'))
newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), unicode(30), u'False')
newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'), unicode(12), u'False', u'footer')
newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False', unicode(u'#FFFFFF'),
unicode(0), unicode(0), unicode(0))
newtheme.add_font(unicode(QtGui.QFont().family()),
unicode(u'#FFFFFF'), unicode(30), u'False')
newtheme.add_font(unicode(QtGui.QFont().family()),
unicode(u'#FFFFFF'), unicode(12), u'False', u'footer')
newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False',
unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0))
xml = newtheme.extract_xml()
theme = ThemeXML()
theme.parse(xml)
theme.extend_image_filename(self.path)
self.cleanTheme(theme)
return theme
def checkThemesExists(self, dir):