forked from openlp/openlp
Next attempt
This commit is contained in:
parent
4be69969fd
commit
d8e5226b20
@ -97,7 +97,6 @@ class Renderer(object):
|
|||||||
self.display.close()
|
self.display.close()
|
||||||
self.display = MainDisplay(None, self.image_manager, False, self)
|
self.display = MainDisplay(None, self.image_manager, False, self)
|
||||||
self.display.setup()
|
self.display.setup()
|
||||||
#self.web_frame = self.web.page().mainFrame()
|
|
||||||
self._theme_dimensions = {}
|
self._theme_dimensions = {}
|
||||||
|
|
||||||
def update_theme(self, theme_name, old_theme_name=None, only_delete=False):
|
def update_theme(self, theme_name, old_theme_name=None, only_delete=False):
|
||||||
@ -223,8 +222,7 @@ class Renderer(object):
|
|||||||
self._set_theme(item_theme_name)
|
self._set_theme(item_theme_name)
|
||||||
self.item_theme_name = item_theme_name
|
self.item_theme_name = item_theme_name
|
||||||
|
|
||||||
def generate_preview(self, theme_data, force_page=False,
|
def generate_preview(self, theme_data, force_page=False):
|
||||||
same_thread=True):
|
|
||||||
"""
|
"""
|
||||||
Generate a preview of a theme.
|
Generate a preview of a theme.
|
||||||
|
|
||||||
@ -259,15 +257,7 @@ class Renderer(object):
|
|||||||
if not self.force_page:
|
if not self.force_page:
|
||||||
self.display.buildHtml(serviceItem)
|
self.display.buildHtml(serviceItem)
|
||||||
raw_html = serviceItem.get_rendered_frame(0)
|
raw_html = serviceItem.get_rendered_frame(0)
|
||||||
if same_thread:
|
self.display.text(raw_html, False)
|
||||||
self.display.text(raw_html)
|
|
||||||
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.
|
|
||||||
# Calling it via a signal seems to workaround the problem.
|
|
||||||
Receiver.send_message(u'renderer_display_text', raw_html)
|
|
||||||
preview = self.display.preview()
|
preview = self.display.preview()
|
||||||
return preview
|
return preview
|
||||||
self.force_page = False
|
self.force_page = False
|
||||||
@ -421,7 +411,6 @@ class Renderer(object):
|
|||||||
# QWebView in order for the display to work properly, but we do. See
|
# 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.
|
# bug #1041366 for an example of what happens if we take this out.
|
||||||
self.web = None
|
self.web = None
|
||||||
gc.collect()
|
|
||||||
self.web = QtWebKit.QWebView()
|
self.web = QtWebKit.QWebView()
|
||||||
self.web.setVisible(False)
|
self.web.setVisible(False)
|
||||||
self.web.resize(self.page_width, self.page_height)
|
self.web.resize(self.page_width, self.page_height)
|
||||||
|
@ -227,20 +227,33 @@ class MainDisplay(Display):
|
|||||||
self.__hideMouse()
|
self.__hideMouse()
|
||||||
log.debug(u'Finished MainDisplay setup')
|
log.debug(u'Finished MainDisplay setup')
|
||||||
|
|
||||||
def text(self, slide):
|
def text(self, slide, animate=True):
|
||||||
"""
|
"""
|
||||||
Add the slide text from slideController
|
Add the slide text from slideController
|
||||||
|
|
||||||
``slide``
|
``slide``
|
||||||
The slide text to be displayed
|
The slide text to be displayed
|
||||||
|
|
||||||
|
``animate``
|
||||||
|
Ensures any transitions are performed when setting the text
|
||||||
"""
|
"""
|
||||||
log.debug(u'text to display')
|
log.debug(u'text to display')
|
||||||
# Wait for the webview to update before displaying text.
|
# Wait for the webview to update before displaying text.
|
||||||
while not self.webLoaded:
|
while not self.webLoaded:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.setGeometry(self.screen[u'size'])
|
self.setGeometry(self.screen[u'size'])
|
||||||
|
if animate:
|
||||||
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
||||||
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
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.
|
||||||
|
# Calling it via a signal seems to workaround the problem.
|
||||||
|
self.frame.findFirstElement("#lyricsmain").setInnerXml(slide)
|
||||||
|
self.frame.findFirstElement("#lyricsoutline").setInnerXml(slide)
|
||||||
|
self.frame.findFirstElement("#lyricsshadow").setInnerXml(slide)
|
||||||
|
|
||||||
def alert(self, text, location):
|
def alert(self, text, location):
|
||||||
"""
|
"""
|
||||||
|
@ -741,7 +741,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'generateImage \n%s ', theme_data)
|
log.debug(u'generateImage \n%s ', theme_data)
|
||||||
return self.mainwindow.renderer.generate_preview(
|
return self.mainwindow.renderer.generate_preview(
|
||||||
theme_data, forcePage, False)
|
theme_data, forcePage)
|
||||||
|
|
||||||
def getPreviewImage(self, theme):
|
def getPreviewImage(self, theme):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user