forked from openlp/openlp
Improved renderer performance: 0.11 vs. 0.29 (average time needed)
bzr-revno: 1962 Fixes: https://launchpad.net/bugs/856296
This commit is contained in:
commit
554df1e363
@ -47,7 +47,6 @@ class FormattingTags(object):
|
||||
Provide access to the html_expands list.
|
||||
"""
|
||||
# Load user defined tags otherwise user defined tags are not present.
|
||||
FormattingTags.load_tags()
|
||||
return FormattingTags.html_expands
|
||||
|
||||
@staticmethod
|
||||
|
@ -131,7 +131,6 @@ class Renderer(object):
|
||||
|
||||
``override_levels``
|
||||
Used to force the theme data passed in to be used.
|
||||
|
||||
"""
|
||||
log.debug(u'set override theme to %s', override_theme)
|
||||
theme_level = self.theme_level
|
||||
@ -500,12 +499,15 @@ class Renderer(object):
|
||||
raw_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.
|
||||
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()
|
||||
# Remove the indexes.
|
||||
raw_tags = [tag[1] for tag in raw_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)
|
||||
|
||||
def _binary_chop(self, formatted, previous_html, previous_raw, html_list,
|
||||
|
@ -195,8 +195,7 @@ class ServiceItem(object):
|
||||
# avoid tracebacks.
|
||||
if self.raw_footer is None:
|
||||
self.raw_footer = []
|
||||
self.foot_text = \
|
||||
u'<br>'.join([footer for footer in self.raw_footer if footer])
|
||||
self.foot_text = u'<br>'.join(filter(None, self.raw_footer))
|
||||
|
||||
def add_from_image(self, path, title, background=None):
|
||||
"""
|
||||
|
@ -164,12 +164,13 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
||||
"""
|
||||
Reset List for loading.
|
||||
"""
|
||||
FormattingTags.load_tags()
|
||||
self.tagTableWidget.clearContents()
|
||||
self.tagTableWidget.setRowCount(0)
|
||||
self.newPushButton.setEnabled(True)
|
||||
self.savePushButton.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.setItem(linenumber, 0,
|
||||
QtGui.QTableWidgetItem(html[u'desc']))
|
||||
|
Loading…
Reference in New Issue
Block a user