From 48c3a0ca4a6c60749711adfb11adfcb37a2a92dc Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 2 Oct 2020 04:49:49 +0000 Subject: [PATCH] Powerpoint fixes --- .../presentations/lib/powerpointcontroller.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 2af547627..3d0c60597 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -156,6 +156,16 @@ class PowerpointDocument(PresentationDocument): trace_error_handler(log) return False + def check_thumbnails(self): + """ + This is an overwritten method of the method in the PresentationDocument class. It adds a check for content + in self.index_map. + + :return: If the thumbnail is valid + :rtype: bool + """ + return super().check_thumbnails() and bool(self.index_map) + def create_thumbnails(self): """ Create the thumbnail images for the current presentation. @@ -169,7 +179,7 @@ class PowerpointDocument(PresentationDocument): """ log.debug('create_thumbnails') generate_thumbs = True - if self.check_thumbnails(): + if super().check_thumbnails(): # No need for thumbnails but we still need the index generate_thumbs = False key = 1 @@ -206,7 +216,7 @@ class PowerpointDocument(PresentationDocument): """ log.debug('is_loaded') try: - if self.controller.process.Presentations.Count == 0: + if self.presentation is None or self.presentation.FullName != str(self.file_path): return False except (AttributeError, pywintypes.com_error): log.exception('Caught exception while in is_loaded') @@ -395,7 +405,7 @@ class PowerpointDocument(PresentationDocument): # SlideShowWindow.View.CurrentShowPosition returns 0 when called when a transition is executing (in 2013) # So we use SlideShowWindow.View.Slide.SlideIndex unless the state is done (ppSlideShowDone = 5) if self.presentation.SlideShowWindow.View.State != 5: - ret = self.presentation.SlideShowWindow.View.Slide.SlideNumber + ret = self.presentation.SlideShowWindow.View.Slide.SlideIndex # Do reverse lookup in the index_map to find the slide number to return ret = next((key for key, slidenum in self.index_map.items() if slidenum == ret), None) else: