Fixed a bug with transparent backgrounds.

bzr-revno: 758
This commit is contained in:
Jonathan Corwin 2010-03-23 15:30:29 +02:00 committed by Raoul Snyman
commit f6e6357176
2 changed files with 11 additions and 8 deletions

View File

@ -144,6 +144,7 @@ def resize_image(image, width, height):
The image to resize. The image to resize.
""" """
preview = QtGui.QImage(image) preview = QtGui.QImage(image)
if not preview.isNull():
preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio, preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
realw = preview.width() realw = preview.width()

View File

@ -159,9 +159,10 @@ class ThemesTab(SettingsTab):
image = self.parent.ThemeManagerContents.getPreviewImage( image = self.parent.ThemeManagerContents.getPreviewImage(
self.global_theme) self.global_theme)
preview = QtGui.QPixmap(unicode(image)) preview = QtGui.QPixmap(unicode(image))
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(display) self.DefaultListView.setPixmap(preview)
def updateThemeList(self, theme_list): def updateThemeList(self, theme_list):
""" """
@ -184,6 +185,7 @@ class ThemesTab(SettingsTab):
image = self.parent.ThemeManagerContents.getPreviewImage( image = self.parent.ThemeManagerContents.getPreviewImage(
self.global_theme) self.global_theme)
preview = QtGui.QPixmap(unicode(image)) preview = QtGui.QPixmap(unicode(image))
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(display) self.DefaultListView.setPixmap(preview)