Fix ThemeXML class as per review comments

Change all references to it
This commit is contained in:
Tim Bentley 2009-04-07 20:45:21 +01:00
parent 0dfe60ef9f
commit 1fb2b366b2
3 changed files with 8 additions and 10 deletions

View File

@ -31,9 +31,8 @@ from serviceitem import ServiceItem
from toolbar import OpenLPToolbar from toolbar import OpenLPToolbar
from songxmlhandler import SongXMLBuilder from songxmlhandler import SongXMLBuilder
from songxmlhandler import SongXMLParser from songxmlhandler import SongXMLParser
from themexmlhandler import ThemeXMLBuilder from themexmlhandler import ThemeXML
from themexmlhandler import ThemeXMLParser
__all__ = ['PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType' __all__ = ['PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType'
'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder', 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
'SongXMLParser', 'EventManager', 'ThemeXMLBuilder', 'ThemeXMLParser'] 'SongXMLParser', 'EventManager', 'ThemeXML']

View File

@ -24,7 +24,7 @@ For XML Schema see wiki.openlp.org
from xml.dom.minidom import Document from xml.dom.minidom import Document
from xml.etree.ElementTree import ElementTree, XML, dump from xml.etree.ElementTree import ElementTree, XML, dump
class ThemeXMLBuilder(): class ThemeXML():
def __init__(self): def __init__(self):
# Create the minidom document # Create the minidom document
self.theme_xml = Document() self.theme_xml = Document()
@ -154,8 +154,7 @@ class ThemeXMLBuilder():
# Print our newly created XML # Print our newly created XML
return self.theme_xml.toxml() return self.theme_xml.toxml()
class ThemeXMLParser(): def parse(self, xml):
def __init__(self, xml):
theme_xml = ElementTree(element=XML(xml)) theme_xml = ElementTree(element=XML(xml))
iter=theme_xml.getiterator() iter=theme_xml.getiterator()
master = u'' master = u''

View File

@ -37,8 +37,7 @@ from openlp.core.lib import Event
from openlp.core.lib import EventType from openlp.core.lib import EventType
from openlp.core.lib import EventManager from openlp.core.lib import EventManager
from openlp.core.lib import OpenLPToolbar from openlp.core.lib import OpenLPToolbar
from openlp.core.lib import ThemeXMLBuilder from openlp.core.lib import ThemeXML
from openlp.core.lib import ThemeXMLParser
from openlp.core.utils import ConfigHelper from openlp.core.utils import ConfigHelper
@ -265,7 +264,7 @@ class ThemeManager(QWidget):
log.debug(u'migrateVersion122 %s %s', filename , fullpath) log.debug(u'migrateVersion122 %s %s', filename , fullpath)
t=Theme(xml_data) t=Theme(xml_data)
newtheme = ThemeXMLBuilder() newtheme = ThemeXML()
newtheme.new_document(t.Name) newtheme.new_document(t.Name)
if t.BackgroundType == 0: if t.BackgroundType == 0:
newtheme.add_background_solid(str(t.BackgroundParameter1.name())) newtheme.add_background_solid(str(t.BackgroundParameter1.name()))
@ -291,7 +290,8 @@ class ThemeManager(QWidget):
def generateImage(self, dir, name, theme_xml): def generateImage(self, dir, name, theme_xml):
log.debug(u'generateImage %s %s ', dir, theme_xml) log.debug(u'generateImage %s %s ', dir, theme_xml)
theme = ThemeXMLParser(theme_xml) theme = ThemeXML()
theme.parse(theme_xml)
#print theme #print theme
size=QtCore.QSize(800,600) size=QtCore.QSize(800,600)
frame=TstFrame(size) frame=TstFrame(size)