Presentation guards against missing images

This commit is contained in:
Tim Bentley 2011-01-22 10:29:47 +00:00
parent ac28cb5183
commit 52367323b0
2 changed files with 24 additions and 8 deletions

View File

@ -392,10 +392,16 @@ class ServiceItem(object):
"""
Returns the title of the raw frame
"""
return self._raw_frames[row][u'title']
try:
return self._raw_frames[row][u'title']
except:
return u''
def get_frame_path(self, row=0):
"""
Returns the path of the raw frame
"""
return self._raw_frames[row][u'path']
try:
return self._raw_frames[row][u'path']
except:
return u''

View File

@ -268,12 +268,22 @@ class PresentationMediaItem(MediaManagerItem):
doc.load_presentation()
i = 1
img = doc.get_thumbnail_path(i, True)
while img:
service_item.add_from_command(path, name, img)
i = i + 1
img = doc.get_thumbnail_path(i, True)
doc.close_presentation()
return True
if img:
while img:
service_item.add_from_command(path, name, img)
i = i + 1
img = doc.get_thumbnail_path(i, True)
doc.close_presentation()
return True
else:
# File is no longer present
criticalErrorMessageBox(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
unicode(translate('PresentationPlugin.MediaItem',
'The Presentation %s is incomplete please reload.'))
% filename)
return False
else:
# File is no longer present
criticalErrorMessageBox(