From 968e30837fe39375eae80d6de4436672d561df4d Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 6 Aug 2013 17:15:06 +0100 Subject: [PATCH] Reload pdf-presentation if images needed is missing instead of displaying an error. --- openlp/plugins/presentations/lib/mediaitem.py | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index dabab5c04..bb5f39a12 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -270,26 +270,18 @@ class PresentationMediaItem(MediaManagerItem): controller = self.controllers[processor] service_item.processor = None doc = controller.add_document(filename) - if doc.get_thumbnail_path(1, True) is None: + if doc.get_thumbnail_path(1, True) is None or not os.path.isfile(os.path.join(doc.get_temp_folder(), u'mainslide001.png')): doc.load_presentation() i = 1 imagefile = u'mainslide%03d.png' % i img = os.path.join(doc.get_temp_folder(), imagefile) - if os.path.isfile(img): - while os.path.isfile(img): - service_item.add_from_image(img, name) - i += 1 - imagefile = u'mainslide%03d.png' % i - img = os.path.join(doc.get_temp_folder(), imagefile) - doc.close_presentation() - return True - else: - # File is no longer present - if not remote: - critical_error_message_box(translate('PresentationPlugin.MediaItem', 'Missing Presentation'), - translate('PresentationPlugin.MediaItem', - 'The presentation %s is incomplete, please reload.') % filename) - return False + while os.path.isfile(img): + service_item.add_from_image(img, name) + i += 1 + imagefile = u'mainslide%03d.png' % i + img = os.path.join(doc.get_temp_folder(), imagefile) + doc.close_presentation() + return True else: # File is no longer present if not remote: