bzr-revno: 2048
Fixes: https://launchpad.net/bugs/1041366
This commit is contained in:
Jonathan Corwin 2012-08-30 20:11:00 +02:00 committed by Raoul Snyman
commit f10f28aed6
2 changed files with 24 additions and 4 deletions

View File

@ -256,7 +256,7 @@ class Renderer(object):
if not self.force_page:
self.display.buildHtml(serviceItem)
raw_html = serviceItem.get_rendered_frame(0)
self.display.text(raw_html)
self.display.text(raw_html, False)
preview = self.display.preview()
return preview
self.force_page = False
@ -406,7 +406,14 @@ 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)
# For the life of my I don't know why we have to completely kill the
# QWebView in order for the display to work properly, but we do. See
# bug #1041366 for an example of what happens if we take this out.
self.web = None
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

@ -224,20 +224,33 @@ class MainDisplay(Display):
self.__hideMouse()
log.debug(u'Finished MainDisplay setup')
def text(self, slide):
def text(self, slide, animate=True):
"""
Add the slide text from slideController
``slide``
The slide text to be displayed
``animate``
Perform transitions if applicable when setting the text
"""
log.debug(u'text to display')
# Wait for the webview to update before displaying text.
while not self.webLoaded:
Receiver.send_message(u'openlp_process_events')
self.setGeometry(self.screen[u'size'])
self.frame.evaluateJavaScript(u'show_text("%s")' %
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
if animate:
self.frame.evaluateJavaScript(u'show_text("%s")' %
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
else:
# This exists for https://bugs.launchpad.net/openlp/+bug/1016843
# For unknown reasons if evaluateJavaScript is called
# from the themewizard, then it causes a crash on
# Windows if there are many items in the service to re-render.
# Setting the div elements direct seems to solve the issue
self.frame.findFirstElement("#lyricsmain").setInnerXml(slide)
self.frame.findFirstElement("#lyricsoutline").setInnerXml(slide)
self.frame.findFirstElement("#lyricsshadow").setInnerXml(slide)
def alert(self, text, location):
"""