openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #15497
[Merge] lp:~googol/openlp/render into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/render into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #856296 in OpenLP: "Improve performance of song loading for Preview/Live"
https://bugs.launchpad.net/openlp/+bug/856296
For more details, see:
https://code.launchpad.net/~googol/openlp/render/+merge/104432
Hello,
Improved renderer performance: 0.11 vs. 0.29 (average time needed)
The best improvement:
Do not load the formatting tags each time you just want to get them (in my quick test I opened OpenLP and added/displayed one song, and load_tags was called 35x!)
--
https://code.launchpad.net/~googol/openlp/render/+merge/104432
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/render into lp:openlp.
=== modified file 'openlp/core/lib/formattingtags.py'
--- openlp/core/lib/formattingtags.py 2011-12-27 10:33:55 +0000
+++ openlp/core/lib/formattingtags.py 2012-05-02 18:29:18 +0000
@@ -47,7 +47,6 @@
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
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2012-04-22 07:32:13 +0000
+++ openlp/core/lib/renderer.py 2012-05-02 18:29:18 +0000
@@ -131,7 +131,6 @@
``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 @@
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,
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2012-03-17 14:44:23 +0000
+++ openlp/core/lib/serviceitem.py 2012-05-02 18:29:18 +0000
@@ -195,8 +195,7 @@
# 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):
"""
=== modified file 'openlp/core/ui/formattingtagform.py'
--- openlp/core/ui/formattingtagform.py 2012-04-02 00:19:16 +0000
+++ openlp/core/ui/formattingtagform.py 2012-05-02 18:29:18 +0000
@@ -164,12 +164,13 @@
"""
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']))
Follow ups