Reduce the number of times a new QWebView is created, which seems to prevent OpenLP from crashing when creating a new theme and there are a lot of items in the service.

bzr-revno: 2008
Fixes: https://launchpad.net/bugs/1016843
This commit is contained in:
Jonathan Corwin 2012-07-02 19:22:56 +02:00 committed by Raoul Snyman
commit 886963b7cb
2 changed files with 4 additions and 4 deletions

View File

@ -82,6 +82,9 @@ class Renderer(object):
self._calculate_default()
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_global'), self.set_global_theme)
self.web = QtWebKit.QWebView()
self.web.setVisible(False)
self.web_frame = self.web.page().mainFrame()
def update_display(self):
"""
@ -404,10 +407,7 @@ class Renderer(object):
if theme_data.font_main_shadow:
self.page_width -= int(theme_data.font_main_shadow_size)
self.page_height -= int(theme_data.font_main_shadow_size)
self.web = QtWebKit.QWebView()
self.web.setVisible(False)
self.web.resize(self.page_width, self.page_height)
self.web_frame = self.web.page().mainFrame()
# Adjust width and height to account for shadow. outline done in css.
html = u"""<!DOCTYPE html><html><head><script>
function show_text(newtext) {

View File

@ -178,7 +178,7 @@ class ServiceItem(object):
self.renderer.set_item_theme(self.theme)
self.themedata, self.main, self.footer = self.renderer.pre_render()
if self.service_item_type == ServiceItemType.Text:
log.debug(u'Formatting slides')
log.debug(u'Formatting slides: %s' % self.title)
for slide in self._raw_frames:
pages = self.renderer.format_slide(slide[u'raw_slide'], self)
for page in pages: