forked from openlp/openlp
Cleanups and fixes
This commit is contained in:
parent
6ecc121bdf
commit
5decd5c466
@ -46,7 +46,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
Constructor
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
#self.parent = parent
|
||||
self.setupUi(self)
|
||||
# Connecting signals and slots
|
||||
self.previewButton = QtGui.QPushButton()
|
||||
@ -124,8 +123,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
self.slideListView.addItem(slide[1])
|
||||
theme = self.customSlide.theme_name
|
||||
id = self.themeComboBox.findText(theme, QtCore.Qt.MatchExactly)
|
||||
# No theme match
|
||||
if id == -1:
|
||||
id = 0 # Not Found
|
||||
id = 0
|
||||
self.themeComboBox.setCurrentIndex(id)
|
||||
else:
|
||||
self.themeComboBox.setCurrentIndex(0)
|
||||
@ -264,7 +264,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
self.titleEdit.setFocus()
|
||||
return False, translate('CustomPlugin.EditCustomForm',
|
||||
'You need to type in a title.')
|
||||
# We must have one slide.
|
||||
# We must have at least one slide.
|
||||
if self.slideListView.count() == 0:
|
||||
return False, translate('CustomPlugin.EditCustomForm',
|
||||
'You need to add at least one slide')
|
||||
|
@ -67,7 +67,7 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
||||
|
||||
def onSplitButtonPressed(self):
|
||||
"""
|
||||
Splits a slide in two slides.
|
||||
Adds a slide split at the cursor.
|
||||
"""
|
||||
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
||||
self.slideTextEdit.insertPlainText(u'\n')
|
||||
|
@ -43,6 +43,7 @@ import logging
|
||||
|
||||
from xml.dom.minidom import Document
|
||||
from xml.etree.ElementTree import ElementTree, XML, dump
|
||||
from lxml import etree, objectify
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -129,10 +130,11 @@ class CustomXMLParser(object):
|
||||
The XML of the song to be parsed.
|
||||
"""
|
||||
self.custom_xml = None
|
||||
if xml[:5] == u'<?xml':
|
||||
xml = xml[38:]
|
||||
try:
|
||||
self.custom_xml = ElementTree(
|
||||
element=XML(unicode(xml).encode('unicode-escape')))
|
||||
except ExpatError:
|
||||
self.custom_xml = objectify.fromstring(xml)
|
||||
except etree.XMLSyntaxError:
|
||||
log.exception(u'Invalid xml %s', xml)
|
||||
|
||||
def get_verses(self):
|
||||
@ -146,8 +148,7 @@ class CustomXMLParser(object):
|
||||
if element.tag == u'verse':
|
||||
if element.text is None:
|
||||
element.text = u''
|
||||
verse_list.append([element.attrib,
|
||||
unicode(element.text).decode('unicode-escape')])
|
||||
verse_list.append([element.attrib, unicode(element.text)])
|
||||
return verse_list
|
||||
|
||||
def dump_xml(self):
|
||||
|
Loading…
Reference in New Issue
Block a user