diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 56a223f06..2756f718e 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -102,11 +102,14 @@ class ImpressController(PresentationController): log.debug(u'get UNO Desktop Openoffice') ctx = None loop = 0 + log.debug(u'get UNO Desktop Openoffice - getComponentContext') context = uno.getComponentContext() + log.debug(u'get UNO Desktop Openoffice - createInstaneWithContext - UnoUrlResolver') resolver = context.ServiceManager.createInstanceWithContext( u'com.sun.star.bridge.UnoUrlResolver', context) while ctx is None and loop < 3: try: + log.debug(u'get UNO Desktop Openoffice - resolve') ctx = resolver.resolve(u'uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext') except: log.exception(u'Unable to find running instance ') @@ -114,6 +117,7 @@ class ImpressController(PresentationController): loop += 1 try: self.manager = ctx.ServiceManager + log.debug(u'get UNO Desktop Openoffice - createInstanceWithContext - Desktop') desktop = self.manager.createInstanceWithContext( "com.sun.star.frame.Desktop", ctx ) return desktop @@ -303,6 +307,13 @@ class ImpressDocument(PresentationDocument): def blank_screen(self): log.debug(u'blank screen OpenOffice') self.control.blankScreen(0) + + def is_blank(self): + """ + Returns true if screen is blank + """ + log.debug(u'is blank OpenOffice') + return self.control.isPaused() def stop_presentation(self): log.debug(u'stop presentation OpenOffice') diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 17a2492ea..c3c9a91f5 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -73,6 +73,9 @@ class Controller(object): log.debug(u'Live = %s, slide' % live) if not live: return + if self.doc.is_blank(): + self.doc.slidenumber = int(slide) + 1 + return self.activate() self.doc.goto_slide(int(slide) + 1) self.doc.poll_slidenumber(live) @@ -84,6 +87,9 @@ class Controller(object): log.debug(u'Live = %s, first' % self.isLive) if not self.isLive: return + if self.doc.is_blank(): + self.doc.slidenumber = 1 + return self.activate() self.doc.start_presentation() self.doc.poll_slidenumber(self.isLive) @@ -95,6 +101,9 @@ class Controller(object): log.debug(u'Live = %s, last' % self.isLive) if not self.isLive: return + if self.doc.is_blank(): + self.doc.slidenumber = self.doc.get_slide_count() + return self.activate() self.doc.goto_slide(self.doc.get_slide_count()) self.doc.poll_slidenumber(self.isLive) @@ -106,6 +115,10 @@ class Controller(object): log.debug(u'Live = %s, next' % self.isLive) if not self.isLive: return + if self.doc.is_blank(): + if self.doc.slidenumber < self.doc.get_slide_count(): + self.doc.slidenumber = self.doc.slidenumber + 1 + return self.activate() self.doc.next_step() self.doc.poll_slidenumber(self.isLive) @@ -117,6 +130,10 @@ class Controller(object): log.debug(u'Live = %s, previous' % self.isLive) if not self.isLive: return + if self.doc.is_blank(): + if self.doc.slidenumber > 1: + self.doc.slidenumber = self.doc.slidenumber - 1 + return self.activate() self.doc.previous_step() self.doc.poll_slidenumber(self.isLive) @@ -126,6 +143,8 @@ class Controller(object): Based on the handler passed at startup triggers slide show to shut down """ log.debug(u'Live = %s, shutdown' % self.isLive) + if self.isLive: + Receiver.send_message(u'live_slide_show') self.doc.close_presentation() self.doc = None #self.doc.slidenumber = 0 @@ -146,6 +165,8 @@ class Controller(object): if not self.isLive: return self.activate() + if self.doc.slidenumber and self.doc.slidenumber != self.doc.get_slide_number(): + self.doc.goto_slide(self.doc.slidenumber) self.doc.unblank_screen() def poll(self): diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 838ab6c8c..909a8439b 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -178,7 +178,7 @@ class PowerpointDocument(PresentationDocument): """ Returns true if a presentation is currently active """ - if not self.controller.is_loaded(): + if not self.is_loaded(): return False try: if self.presentation.SlideShowWindow == None: @@ -203,6 +203,12 @@ class PowerpointDocument(PresentationDocument): """ self.presentation.SlideShowWindow.View.State = 3 + def is_blank(self): + """ + Returns true if screen is blank + """ + return self.presentation.SlideShowWindow.View.State == 3 + def stop_presentation(self): """ Stops the current presentation and hides the output diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index d3332f68c..3780d1225 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -104,6 +104,7 @@ class PptviewDocument(PresentationDocument): log.debug(u'Init Presentation PowerPoint') self.presentation = None self.pptid = None + self.blanked = False self.controller = controller self.store_filename(presentation) @@ -161,12 +162,21 @@ class PptviewDocument(PresentationDocument): Blanks the screen """ self.controller.process.Blank(self.pptid) + self.blanked = True def unblank_screen(self): """ Unblanks (restores) the presentationn """ self.controller.process.Unblank(self.pptid) + self.blanked = False + + def is_blank(self): + """ + Returns true if screen is blank + """ + log.debug(u'is blank OpenOffice') + return self.blanked def stop_presentation(self): """ diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 5a914e1cc..ae41a56b1 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -172,6 +172,9 @@ class PresentationDocument(object): ``unblank_screen()`` Unblanks the screen, restoring the output + ``is_blank`` + Returns true if screen is blank + ``stop_presentation()`` Stops the presentation, removing it from the output display @@ -279,6 +282,12 @@ class PresentationDocument(object): """ pass + def is_blank(self): + """ + Returns true if screen is blank + """ + return False + def stop_presentation(self): """ Stops the presentation, removing it from the output display