From dbef87021c0a268d9a5637360d72b0ef9d78366d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 21 Jun 2011 12:10:53 +0200 Subject: [PATCH] minor clean ups; do not create qimage and then convert to qpixmap, instad create qpixmap directly --- openlp/core/ui/slidecontroller.py | 4 ++-- openlp/plugins/presentations/lib/mediaitem.py | 2 +- openlp/plugins/presentations/lib/presentationcontroller.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 30341b9dd..5ea2c5f23 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -625,14 +625,14 @@ class SlideController(QtGui.QWidget): label.setMargin(4) label.setScaledContents(True) if self.serviceItem.is_command(): - image = QtGui.QImage(frame[u'image']) + label.setPixmap(QtGui.QPixmap(frame[u'image'])) else: # If current slide set background to image if framenumber == slideno: self.serviceItem.bg_image_bytes = \ self.imageManager.get_image_bytes(frame[u'title']) image = self.imageManager.get_image(frame[u'title']) - label.setPixmap(QtGui.QPixmap.fromImage(image)) + label.setPixmap(QtGui.QPixmap.fromImage(image)) self.previewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent().renderer.screen_ratio row += 1 diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 5e14a88eb..e0bc1be0d 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -191,7 +191,7 @@ class PresentationMediaItem(MediaManagerItem): doc.load_presentation() preview = doc.get_thumbnail_path(1, True) doc.close_presentation() - if not os.path.exists(preview): + if not (preview and os.path.exists(preview)): icon = build_icon(u':/general/general_delete.png') else: if validate_thumb(preview, thumb): diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index f0588e1bc..c26396229 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -149,7 +149,7 @@ class PresentationDocument(object): the powerpoint file. """ lastimage = self.get_thumbnail_path(self.get_slide_count(), True) - if not os.path.isfile(lastimage): + if not (lastimage and os.path.isfile(lastimage)): return False return validate_thumb(self.filepath, lastimage)