← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/present into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/present into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Get rid of QImage::scaled: Image is a null image errors from the console when dealing with transparent themes.
-- 
https://code.launchpad.net/~j-corwin/openlp/present/+merge/21903
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2010-03-21 23:58:01 +0000
+++ openlp/core/lib/__init__.py	2010-03-22 23:53:16 +0000
@@ -144,8 +144,9 @@
         The image to resize.
     """
     preview = QtGui.QImage(image)
-    preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
-        QtCore.Qt.SmoothTransformation)
+    if not preview.isNull():
+        preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
+            QtCore.Qt.SmoothTransformation)
     realw = preview.width()
     realh = preview.height()
     # and move it to the centre of the preview space

=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py	2010-03-21 23:58:01 +0000
+++ openlp/core/ui/themestab.py	2010-03-22 23:53:16 +0000
@@ -159,9 +159,10 @@
         image = self.parent.ThemeManagerContents.getPreviewImage(
             self.global_theme)
         preview = QtGui.QPixmap(unicode(image))
-        display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
-            QtCore.Qt.SmoothTransformation)
-        self.DefaultListView.setPixmap(display)
+        if not preview.isNull():
+            preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
+                QtCore.Qt.SmoothTransformation)
+        self.DefaultListView.setPixmap(preview)
 
     def updateThemeList(self, theme_list):
         """
@@ -184,6 +185,7 @@
             image = self.parent.ThemeManagerContents.getPreviewImage(
                 self.global_theme)
             preview = QtGui.QPixmap(unicode(image))
-            display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
-                QtCore.Qt.SmoothTransformation)
-            self.DefaultListView.setPixmap(display)
+            if not preview.isNull():
+                preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
+                    QtCore.Qt.SmoothTransformation)
+            self.DefaultListView.setPixmap(preview)


Follow ups