Presentation plugin - still getting there

This commit is contained in:
Tim Bentley 2009-09-06 09:11:32 +01:00
parent 7e398174cf
commit e613cdac81
2 changed files with 17 additions and 5 deletions

View File

@ -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()

View File

@ -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()