minor clean ups; do not create qimage and then convert to qpixmap, instad create qpixmap directly

This commit is contained in:
Andreas Preikschat 2011-06-21 12:10:53 +02:00
parent 3616554a17
commit dbef87021c
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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):

View File

@ -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)