← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/fixes into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #598393 After adding a new image to a selected (image) item in the service manager it is not selected anymore
  https://bugs.launchpad.net/bugs/598393

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/fixes/+merge/47168

Hello!

- 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"
-- 
https://code.launchpad.net/~googol-hush/openlp/fixes/+merge/47168
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/fixes into lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-01-19 21:36:43 +0000
+++ openlp/core/ui/maindisplay.py	2011-01-22 20:01:56 +0000
@@ -137,11 +137,10 @@
             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 @@
         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 @@
         Generates a preview of the image displayed.
         """
         log.debug(u'preview for %s', self.isLive)
+        Receiver.send_message(u'openlp_process_events')
         # 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:
+        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 @@
         # 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)

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-01-22 11:20:50 +0000
+++ openlp/core/ui/slidecontroller.py	2011-01-22 20:01:56 +0000
@@ -783,6 +783,7 @@
             QtCore.QSettings().remove(
                 self.parent.generalSettingsSection + u'/screen blank')
         self.blankPlugin(checked)
+        self.updatePreview()
 
     def onThemeDisplay(self, checked):
         """
@@ -804,6 +805,7 @@
             QtCore.QSettings().remove(
                 self.parent.generalSettingsSection + u'/screen blank')
         self.blankPlugin(checked)
+        self.updatePreview()
 
     def onHideDisplay(self, checked):
         """
@@ -827,6 +829,7 @@
             QtCore.QSettings().remove(
                 self.parent.generalSettingsSection + u'/screen blank')
         self.hidePlugin(checked)
+        self.updatePreview()
 
     def blankPlugin(self, blank):
         """
@@ -896,7 +899,11 @@
             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 @@
                 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(),


Follow ups