Error handling for Impress being closed during presentation

This commit is contained in:
Jonathan Corwin 2009-10-15 22:49:31 +01:00
parent 0cbd5f16fa
commit ee069cbcab
2 changed files with 16 additions and 8 deletions

View File

@ -122,6 +122,7 @@ class ImpressController(PresentationController):
if desktop is None:
return
try:
self.desktop = desktop
properties = []
properties = tuple(properties)
self.document = desktop.loadComponentFromURL(url, u'_blank',
@ -218,9 +219,15 @@ class ImpressController(PresentationController):
self.document = None
def is_loaded(self):
return self.presentation is not None \
and self.document is not None \
and self.controller is not None
if self.presentation is None or self.document is None \
or self.controller is None:
return False
try:
if self.document.getPresentation() is None:
return False
except:
return False
return True
def is_active(self):
if not self.is_loaded():
@ -235,12 +242,14 @@ class ImpressController(PresentationController):
def stop_presentation(self):
self.controller.deactivate()
# self.presdoc.end()
def start_presentation(self):
if not self.controller.isRunning():
self.presentation.start()
self.controller = self.desktop.getCurrentComponent().Presentation.getController()
else:
self.controller.activate()
self.goto_slide(1)
# self.presdoc.start()
def get_slide_number(self):
return self.controller.getCurrentSlideIndex()

View File

@ -252,4 +252,3 @@ class PowerpointController(PresentationController):
"""
return os.path.join(self.thumbnailpath,
self.thumbnailprefix + unicode(slide_no) + u'.png')
\