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