forked from openlp/openlp
improve performance of preview
Fixes: https://launchpad.net/bugs/856296
This commit is contained in:
parent
59640dd04f
commit
88c0a22ac4
@ -201,7 +201,8 @@ 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)
|
||||||
preview = self.display.text(raw_html)
|
self.display.text(raw_html)
|
||||||
|
preview = self.display.preview()
|
||||||
# Reset the real screen size for subsequent render requests
|
# Reset the real screen size for subsequent render requests
|
||||||
self._calculate_default()
|
self._calculate_default()
|
||||||
return preview
|
return preview
|
||||||
|
@ -194,7 +194,6 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
self.setGeometry(self.screen[u'size'])
|
self.setGeometry(self.screen[u'size'])
|
||||||
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'\\\"'))
|
||||||
return self.preview()
|
|
||||||
|
|
||||||
def alert(self, text):
|
def alert(self, text):
|
||||||
"""
|
"""
|
||||||
@ -256,7 +255,6 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
image = self.imageManager.get_image_bytes(name)
|
image = self.imageManager.get_image_bytes(name)
|
||||||
self.resetVideo()
|
self.resetVideo()
|
||||||
self.displayImage(image)
|
self.displayImage(image)
|
||||||
return self.preview()
|
|
||||||
|
|
||||||
def displayImage(self, image):
|
def displayImage(self, image):
|
||||||
"""
|
"""
|
||||||
@ -387,7 +385,6 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
# Update the preview frame.
|
# Update the preview frame.
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
Receiver.send_message(u'maindisplay_active')
|
Receiver.send_message(u'maindisplay_active')
|
||||||
return self.preview()
|
|
||||||
|
|
||||||
def videoState(self, newState, oldState):
|
def videoState(self, newState, oldState):
|
||||||
"""
|
"""
|
||||||
@ -455,9 +452,8 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
else:
|
else:
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
preview = QtGui.QImage(self.screen[u'size'].width(),
|
preview = QtGui.QPixmap(self.screen[u'size'].width(),
|
||||||
self.screen[u'size'].height(),
|
self.screen[u'size'].height())
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
|
||||||
painter = QtGui.QPainter(preview)
|
painter = QtGui.QPainter(preview)
|
||||||
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||||
self.frame.render(painter)
|
self.frame.render(painter)
|
||||||
|
@ -940,16 +940,15 @@ class SlideController(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
toDisplay = self.serviceItem.get_rendered_frame(row)
|
toDisplay = self.serviceItem.get_rendered_frame(row)
|
||||||
if self.serviceItem.is_text():
|
if self.serviceItem.is_text():
|
||||||
frame = self.display.text(toDisplay)
|
self.display.text(toDisplay)
|
||||||
else:
|
else:
|
||||||
if start:
|
if start:
|
||||||
self.display.buildHtml(self.serviceItem, toDisplay)
|
self.display.buildHtml(self.serviceItem, toDisplay)
|
||||||
frame = self.display.preview()
|
|
||||||
else:
|
else:
|
||||||
frame = self.display.image(toDisplay)
|
self.display.image(toDisplay)
|
||||||
# reset the store used to display first image
|
# reset the store used to display first image
|
||||||
self.serviceItem.bg_image_bytes = None
|
self.serviceItem.bg_image_bytes = None
|
||||||
self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.slidePreview.setPixmap(self.display.preview())
|
||||||
self.selectedRow = row
|
self.selectedRow = row
|
||||||
self.__checkUpdateSelectedSlide(row)
|
self.__checkUpdateSelectedSlide(row)
|
||||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||||
@ -977,8 +976,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||||
QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
|
QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
|
||||||
else:
|
else:
|
||||||
self.slidePreview.setPixmap(
|
self.slidePreview.setPixmap(self.display.preview())
|
||||||
QtGui.QPixmap.fromImage(self.display.preview()))
|
|
||||||
|
|
||||||
def grabMainDisplay(self):
|
def grabMainDisplay(self):
|
||||||
"""
|
"""
|
||||||
|
@ -232,7 +232,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
if self.page(pageId) == self.previewPage:
|
if self.page(pageId) == self.previewPage:
|
||||||
self.updateTheme()
|
self.updateTheme()
|
||||||
frame = self.thememanager.generateImage(self.theme)
|
frame = self.thememanager.generateImage(self.theme)
|
||||||
self.previewBoxLabel.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.previewBoxLabel.setPixmap(frame)
|
||||||
self.displayAspectRatio = float(frame.width()) / frame.height()
|
self.displayAspectRatio = float(frame.width()) / frame.height()
|
||||||
self.resizeEvent()
|
self.resizeEvent()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user