forked from openlp/openlp
Merge fixes
This commit is contained in:
parent
6b2dc8a8bd
commit
e33628e049
@ -293,6 +293,7 @@ def clean_tags(text):
|
|||||||
Remove Tags from text for display
|
Remove Tags from text for display
|
||||||
"""
|
"""
|
||||||
text = text.replace(u'<br>', u'\n')
|
text = text.replace(u'<br>', u'\n')
|
||||||
|
text = text.replace(u' ', u' ')
|
||||||
for tag in DisplayTags.get_html_tags():
|
for tag in DisplayTags.get_html_tags():
|
||||||
text = text.replace(tag[u'start tag'], u'')
|
text = text.replace(tag[u'start tag'], u'')
|
||||||
text = text.replace(tag[u'end tag'], u'')
|
text = text.replace(tag[u'end tag'], u'')
|
||||||
|
@ -527,7 +527,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
log.exception(u'Theme XML is not UTF-8 '
|
log.exception(u'Theme XML is not UTF-8 '
|
||||||
u'encoded.')
|
u'encoded.')
|
||||||
break
|
break
|
||||||
filexml = self.checkVersionAndConvert(xml_data)
|
filexml = self._checkVersionAndConvert(xml_data)
|
||||||
outfile = open(fullpath, u'w')
|
outfile = open(fullpath, u'w')
|
||||||
outfile.write(filexml.encode(u'utf-8'))
|
outfile.write(filexml.encode(u'utf-8'))
|
||||||
else:
|
else:
|
||||||
@ -557,22 +557,6 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if outfile:
|
if outfile:
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|
||||||
def checkVersionAndConvert(self, xml_data):
|
|
||||||
"""
|
|
||||||
Check if a theme is from OpenLP version 1
|
|
||||||
|
|
||||||
``xml_data``
|
|
||||||
Theme XML to check the version of
|
|
||||||
"""
|
|
||||||
log.debug(u'checkVersion1 ')
|
|
||||||
theme = xml_data.encode(u'ascii', u'xmlcharrefreplace')
|
|
||||||
tree = ElementTree(element=XML(theme)).getroot()
|
|
||||||
# look for old version 1 tags
|
|
||||||
if tree.find(u'BackgroundType') is None:
|
|
||||||
return xml_data
|
|
||||||
else:
|
|
||||||
return self._migrateVersion122(xml_data)
|
|
||||||
|
|
||||||
def checkIfThemeExists(self, themeName):
|
def checkIfThemeExists(self, themeName):
|
||||||
"""
|
"""
|
||||||
Check if theme already exists and displays error message
|
Check if theme already exists and displays error message
|
||||||
@ -667,6 +651,22 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
image = os.path.join(self.path, theme + u'.png')
|
image = os.path.join(self.path, theme + u'.png')
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
def _checkVersionAndConvert(self, xml_data):
|
||||||
|
"""
|
||||||
|
Check if a theme is from OpenLP version 1
|
||||||
|
|
||||||
|
``xml_data``
|
||||||
|
Theme XML to check the version of
|
||||||
|
"""
|
||||||
|
log.debug(u'checkVersion1 ')
|
||||||
|
theme = xml_data.encode(u'ascii', u'xmlcharrefreplace')
|
||||||
|
tree = ElementTree(element=XML(theme)).getroot()
|
||||||
|
# look for old version 1 tags
|
||||||
|
if tree.find(u'BackgroundType') is None:
|
||||||
|
return xml_data
|
||||||
|
else:
|
||||||
|
return self._migrateVersion122(xml_data)
|
||||||
|
|
||||||
def _createThemeFromXml(self, themeXml, path):
|
def _createThemeFromXml(self, themeXml, path):
|
||||||
"""
|
"""
|
||||||
Return a theme object using information parsed from XML
|
Return a theme object using information parsed from XML
|
||||||
|
@ -716,21 +716,21 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
second_copyright, second_permissions)
|
second_copyright, second_permissions)
|
||||||
if footer not in raw_footer:
|
if footer not in raw_footer:
|
||||||
raw_footer.append(footer)
|
raw_footer.append(footer)
|
||||||
bible_text = u'%s%s\n\n%s%s' % (verse_text, text,
|
bible_text = u'%s %s\n\n%s%s' % (verse_text, text,
|
||||||
verse_text, second_text)
|
verse_text, second_text)
|
||||||
raw_slides.append(bible_text.rstrip())
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Slide' then create a new slide.
|
# If we are 'Verse Per Slide' then create a new slide.
|
||||||
elif self.parent.settings_tab.layout_style == 0:
|
elif self.parent.settings_tab.layout_style == 0:
|
||||||
bible_text = u'%s%s' % (verse_text, text)
|
bible_text = u'%s %s' % (verse_text, text)
|
||||||
raw_slides.append(bible_text.rstrip())
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Line' then force a new line.
|
# If we are 'Verse Per Line' then force a new line.
|
||||||
elif self.parent.settings_tab.layout_style == 1:
|
elif self.parent.settings_tab.layout_style == 1:
|
||||||
bible_text = u'%s %s%s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
||||||
# We have to be 'Continuous'.
|
# We have to be 'Continuous'.
|
||||||
else:
|
else:
|
||||||
bible_text = u'%s %s%s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
||||||
if not old_item:
|
if not old_item:
|
||||||
start_item = item
|
start_item = item
|
||||||
elif self.checkTitle(item, old_item):
|
elif self.checkTitle(item, old_item):
|
||||||
|
Loading…
Reference in New Issue
Block a user