forked from openlp/openlp
- fixed a bug, which occurs when you "replace live background" when no item is live (so basically after starting OpenLP)
- update the little preview frame, when you "Blank to Theme/Screen" bzr-revno: 1242
This commit is contained in:
commit
b5e538815f
@ -137,11 +137,10 @@ class MainDisplay(DisplayWidget):
|
||||
painter_image.begin(initialFrame)
|
||||
painter_image.fillRect(initialFrame.rect(), QtCore.Qt.white)
|
||||
painter_image.drawImage(
|
||||
(self.screens.current[u'size'].width() \
|
||||
- splash_image.width()) / 2,
|
||||
(self.screens.current[u'size'].height() \
|
||||
- splash_image.height()) / 2,
|
||||
splash_image)
|
||||
(self.screens.current[u'size'].width() -
|
||||
splash_image.width()) / 2,
|
||||
(self.screens.current[u'size'].height()
|
||||
- splash_image.height()) / 2, splash_image)
|
||||
serviceItem = ServiceItem()
|
||||
serviceItem.bg_image_bytes = image_to_byte(initialFrame)
|
||||
self.webView.setHtml(build_html(serviceItem, self.screen,
|
||||
@ -241,7 +240,10 @@ class MainDisplay(DisplayWidget):
|
||||
Used after Image plugin has changed the background
|
||||
"""
|
||||
log.debug(u'resetImage')
|
||||
self.displayImage(self.serviceItem.bg_image_bytes)
|
||||
if hasattr(self, u'serviceItem'):
|
||||
self.displayImage(self.serviceItem.bg_image_bytes)
|
||||
else:
|
||||
self.displayImage(None)
|
||||
# Update the preview frame.
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
|
||||
@ -343,13 +345,11 @@ class MainDisplay(DisplayWidget):
|
||||
Generates a preview of the image displayed.
|
||||
"""
|
||||
log.debug(u'preview for %s', self.isLive)
|
||||
# We must have a service item to preview
|
||||
if not hasattr(self, u'serviceItem'):
|
||||
return
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
if self.isLive:
|
||||
# We must have a service item to preview
|
||||
if self.isLive and hasattr(self, u'serviceItem'):
|
||||
# Wait for the fade to finish before geting the preview.
|
||||
# Important otherwise preview will have incorrect text if at all !
|
||||
# Important otherwise preview will have incorrect text if at all!
|
||||
if self.serviceItem.themedata and \
|
||||
self.serviceItem.themedata.display_slide_transition:
|
||||
while self.frame.evaluateJavaScript(u'show_text_complete()') \
|
||||
@ -362,9 +362,8 @@ class MainDisplay(DisplayWidget):
|
||||
# if was hidden keep it hidden
|
||||
if self.isLive:
|
||||
self.setVisible(True)
|
||||
# if was hidden keep it hidden
|
||||
if self.hideMode and self.isLive:
|
||||
self.hideDisplay(self.hideMode)
|
||||
if self.hideMode:
|
||||
self.hideDisplay(self.hideMode)
|
||||
preview = QtGui.QImage(self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height(),
|
||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||
|
@ -783,6 +783,7 @@ class SlideController(QtGui.QWidget):
|
||||
QtCore.QSettings().remove(
|
||||
self.parent.generalSettingsSection + u'/screen blank')
|
||||
self.blankPlugin(checked)
|
||||
self.updatePreview()
|
||||
|
||||
def onThemeDisplay(self, checked):
|
||||
"""
|
||||
@ -804,6 +805,7 @@ class SlideController(QtGui.QWidget):
|
||||
QtCore.QSettings().remove(
|
||||
self.parent.generalSettingsSection + u'/screen blank')
|
||||
self.blankPlugin(checked)
|
||||
self.updatePreview()
|
||||
|
||||
def onHideDisplay(self, checked):
|
||||
"""
|
||||
@ -827,6 +829,7 @@ class SlideController(QtGui.QWidget):
|
||||
QtCore.QSettings().remove(
|
||||
self.parent.generalSettingsSection + u'/screen blank')
|
||||
self.hidePlugin(checked)
|
||||
self.updatePreview()
|
||||
|
||||
def blankPlugin(self, blank):
|
||||
"""
|
||||
@ -896,7 +899,11 @@ class SlideController(QtGui.QWidget):
|
||||
row)
|
||||
|
||||
def updatePreview(self):
|
||||
log.debug(u'updatePreview %s ' %self.screens.current[u'primary'])
|
||||
"""
|
||||
This updates the preview frame, for example after changing a slide or
|
||||
using *Blank to Theme*.
|
||||
"""
|
||||
log.debug(u'updatePreview %s ' % self.screens.current[u'primary'])
|
||||
if not self.screens.current[u'primary']:
|
||||
# Grab now, but try again in a couple of seconds if slide change
|
||||
# is slow
|
||||
@ -907,6 +914,9 @@ class SlideController(QtGui.QWidget):
|
||||
QtGui.QPixmap.fromImage(self.display.preview()))
|
||||
|
||||
def grabMainDisplay(self):
|
||||
"""
|
||||
Creates an image of the current screen and updates the preview frame.
|
||||
"""
|
||||
winid = QtGui.QApplication.desktop().winId()
|
||||
rect = self.screens.current[u'size']
|
||||
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
|
||||
|
Loading…
Reference in New Issue
Block a user