forked from openlp/openlp
update text on main event thread
This commit is contained in:
parent
eb6704cf01
commit
9864bf9084
@ -79,6 +79,8 @@ class Renderer(object):
|
||||
self.force_page = False
|
||||
self.display = MainDisplay(None, self.image_manager, False, self)
|
||||
self.display.setup()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'renderer_update_text'), self.update_text)
|
||||
self._theme_dimensions = {}
|
||||
self._calculate_default()
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -223,7 +225,8 @@ class Renderer(object):
|
||||
self._set_theme(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.
|
||||
|
||||
@ -258,11 +261,17 @@ class Renderer(object):
|
||||
if not self.force_page:
|
||||
self.display.buildHtml(serviceItem)
|
||||
raw_html = serviceItem.get_rendered_frame(0)
|
||||
self.display.text(raw_html)
|
||||
if same_thread:
|
||||
Receiver.send_message(u'renderer_update_text', raw_html)
|
||||
else:
|
||||
self.update_text(raw_html)
|
||||
preview = self.display.preview()
|
||||
return preview
|
||||
self.force_page = False
|
||||
|
||||
def update_text(self, text):
|
||||
self.display.text(text)
|
||||
com
|
||||
def format_slide(self, text, item):
|
||||
"""
|
||||
Calculate how much text can fit on a slide.
|
||||
|
@ -741,7 +741,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
"""
|
||||
log.debug(u'generateImage \n%s ', theme_data)
|
||||
return self.mainwindow.renderer.generate_preview(
|
||||
theme_data, forcePage)
|
||||
theme_data, forcePage, False)
|
||||
|
||||
def getPreviewImage(self, theme):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user