From 8524bf9174c4aa3550269d288cc436bc0ce07cf8 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Mon, 22 Mar 2010 23:50:32 +0000 Subject: [PATCH] Remove transparent error: QImage::scaled: Image is a null image --- openlp/core/lib/__init__.py | 5 +++-- openlp/core/ui/themestab.py | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index fc6a4bf0c..84525352e 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -144,8 +144,9 @@ def resize_image(image, width, height): 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 diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index fff8c384c..0deca94e9 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -159,9 +159,10 @@ class ThemesTab(SettingsTab): 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 @@ class ThemesTab(SettingsTab): 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)