forked from openlp/openlp
improved renderer performance
This commit is contained in:
parent
3255b9d492
commit
6915fb9d0d
@ -47,7 +47,6 @@ class FormattingTags(object):
|
|||||||
Provide access to the html_expands list.
|
Provide access to the html_expands list.
|
||||||
"""
|
"""
|
||||||
# Load user defined tags otherwise user defined tags are not present.
|
# Load user defined tags otherwise user defined tags are not present.
|
||||||
FormattingTags.load_tags()
|
|
||||||
return FormattingTags.html_expands
|
return FormattingTags.html_expands
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -131,7 +131,6 @@ class Renderer(object):
|
|||||||
|
|
||||||
``override_levels``
|
``override_levels``
|
||||||
Used to force the theme data passed in to be used.
|
Used to force the theme data passed in to be used.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
log.debug(u'set override theme to %s', override_theme)
|
log.debug(u'set override theme to %s', override_theme)
|
||||||
theme_level = self.theme_level
|
theme_level = self.theme_level
|
||||||
@ -500,12 +499,15 @@ class Renderer(object):
|
|||||||
raw_tags.sort(key=lambda tag: tag[0])
|
raw_tags.sort(key=lambda tag: tag[0])
|
||||||
html_tags.sort(key=lambda tag: tag[0])
|
html_tags.sort(key=lambda tag: tag[0])
|
||||||
# Create a list with closing tags for the raw_text.
|
# Create a list with closing tags for the raw_text.
|
||||||
end_tags = [tag[2] for tag in raw_tags]
|
end_tags = []
|
||||||
|
start_tags = []
|
||||||
|
for tag in raw_tags:
|
||||||
|
start_tags.append(tag[1])
|
||||||
|
end_tags.append(tag[2])
|
||||||
end_tags.reverse()
|
end_tags.reverse()
|
||||||
# Remove the indexes.
|
# Remove the indexes.
|
||||||
raw_tags = [tag[1] for tag in raw_tags]
|
|
||||||
html_tags = [tag[1] for tag in html_tags]
|
html_tags = [tag[1] for tag in html_tags]
|
||||||
return raw_text + u''.join(end_tags), u''.join(raw_tags), \
|
return raw_text + u''.join(end_tags), u''.join(start_tags), \
|
||||||
u''.join(html_tags)
|
u''.join(html_tags)
|
||||||
|
|
||||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list,
|
def _binary_chop(self, formatted, previous_html, previous_raw, html_list,
|
||||||
|
@ -195,8 +195,7 @@ class ServiceItem(object):
|
|||||||
# avoid tracebacks.
|
# avoid tracebacks.
|
||||||
if self.raw_footer is None:
|
if self.raw_footer is None:
|
||||||
self.raw_footer = []
|
self.raw_footer = []
|
||||||
self.foot_text = \
|
self.foot_text = u'<br>'.join(filter(None, self.raw_footer))
|
||||||
u'<br>'.join([footer for footer in self.raw_footer if footer])
|
|
||||||
|
|
||||||
def add_from_image(self, path, title, background=None):
|
def add_from_image(self, path, title, background=None):
|
||||||
"""
|
"""
|
||||||
|
@ -164,12 +164,13 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||||||
"""
|
"""
|
||||||
Reset List for loading.
|
Reset List for loading.
|
||||||
"""
|
"""
|
||||||
|
FormattingTags.load_tags()
|
||||||
self.tagTableWidget.clearContents()
|
self.tagTableWidget.clearContents()
|
||||||
self.tagTableWidget.setRowCount(0)
|
self.tagTableWidget.setRowCount(0)
|
||||||
self.newPushButton.setEnabled(True)
|
self.newPushButton.setEnabled(True)
|
||||||
self.savePushButton.setEnabled(False)
|
self.savePushButton.setEnabled(False)
|
||||||
self.deletePushButton.setEnabled(False)
|
self.deletePushButton.setEnabled(False)
|
||||||
for linenumber, html in enumerate(FormattingTags.html_expands):
|
for linenumber, html in enumerate(FormattingTags.get_html_tags()):
|
||||||
self.tagTableWidget.setRowCount(self.tagTableWidget.rowCount() + 1)
|
self.tagTableWidget.setRowCount(self.tagTableWidget.rowCount() + 1)
|
||||||
self.tagTableWidget.setItem(linenumber, 0,
|
self.tagTableWidget.setItem(linenumber, 0,
|
||||||
QtGui.QTableWidgetItem(html[u'desc']))
|
QtGui.QTableWidgetItem(html[u'desc']))
|
||||||
|
Loading…
Reference in New Issue
Block a user