From e613cdac810298a73bc0f99317168279448f9403 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 6 Sep 2009 09:11:32 +0100 Subject: [PATCH] Presentation plugin - still getting there --- .../presentations/lib/impresscontroller.py | 16 ++++++++++++++-- .../plugins/presentations/presentationplugin.py | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 4a022d0e5..356397945 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -41,6 +41,8 @@ class ImpressController(object): def __init__(self): log.debug(u'Initialising') self.process = None + self.document = None + self.presentation = None self.startOpenoffice() def startOpenoffice(self): @@ -52,7 +54,7 @@ class ImpressController(object): def kill(self): log.debug(u'Kill') - self.process.terminate() + self.closePresentation() def loadPresentation(self, presentation): log.debug(u'create Resolver') @@ -72,7 +74,17 @@ class ImpressController(object): log.error(u'Failed reason %s' % sys.exc_info()) def closePresentation(self): - self.document.dispose() + """ + Close presentation and clean up objects + Triggerent by new object being added to SlideController orOpenLP + being shut down + """ + if self.document is not None: + if self.presentation is not None: + self.presentation.end() + self.presentation = None + self.document.dispose() + self.document = None def isActive(self): return self.presentation.isRunning() and self.presentation.isActive() diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 3e5dea20d..09928b4ba 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -66,7 +66,7 @@ class PresentationPlugin(Plugin): If Not do not install the plugin. """ log.debug('check_pre_conditions') - + #Lets see if Impress is required (Default is Not wanted) if int(self.config.get_config(u'Impress', 0)) == 2: try: #Check to see if we have uno installed @@ -75,7 +75,7 @@ class PresentationPlugin(Plugin): self.registerControllers(u'Impress', openoffice) except: log.error(u'Reason : %s', sys.exc_info())#[0]) - #If we have no controllers disable plugin + #If we have no available controllers disable plugin if len(self.controllers) > 0: return True else: @@ -83,7 +83,7 @@ class PresentationPlugin(Plugin): def finalise(self): log.debug(u'Finalise') - print self.controllers + #Ask each controller to tidy up for controller in self.controllers: print controller self.controllers[controller].kill()