forked from openlp/openlp
Error handling for Impress being closed during presentation
This commit is contained in:
parent
0cbd5f16fa
commit
ee069cbcab
@ -122,6 +122,7 @@ class ImpressController(PresentationController):
|
|||||||
if desktop is None:
|
if desktop is None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
self.desktop = desktop
|
||||||
properties = []
|
properties = []
|
||||||
properties = tuple(properties)
|
properties = tuple(properties)
|
||||||
self.document = desktop.loadComponentFromURL(url, u'_blank',
|
self.document = desktop.loadComponentFromURL(url, u'_blank',
|
||||||
@ -218,9 +219,15 @@ class ImpressController(PresentationController):
|
|||||||
self.document = None
|
self.document = None
|
||||||
|
|
||||||
def is_loaded(self):
|
def is_loaded(self):
|
||||||
return self.presentation is not None \
|
if self.presentation is None or self.document is None \
|
||||||
and self.document is not None \
|
or self.controller is None:
|
||||||
and self.controller is not None
|
return False
|
||||||
|
try:
|
||||||
|
if self.document.getPresentation() is None:
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
if not self.is_loaded():
|
if not self.is_loaded():
|
||||||
@ -235,12 +242,14 @@ class ImpressController(PresentationController):
|
|||||||
|
|
||||||
def stop_presentation(self):
|
def stop_presentation(self):
|
||||||
self.controller.deactivate()
|
self.controller.deactivate()
|
||||||
# self.presdoc.end()
|
|
||||||
|
|
||||||
def start_presentation(self):
|
def start_presentation(self):
|
||||||
self.controller.activate()
|
if not self.controller.isRunning():
|
||||||
self.goto_slide(1)
|
self.presentation.start()
|
||||||
# self.presdoc.start()
|
self.controller = self.desktop.getCurrentComponent().Presentation.getController()
|
||||||
|
else:
|
||||||
|
self.controller.activate()
|
||||||
|
self.goto_slide(1)
|
||||||
|
|
||||||
def get_slide_number(self):
|
def get_slide_number(self):
|
||||||
return self.controller.getCurrentSlideIndex()
|
return self.controller.getCurrentSlideIndex()
|
||||||
|
@ -252,4 +252,3 @@ class PowerpointController(PresentationController):
|
|||||||
"""
|
"""
|
||||||
return os.path.join(self.thumbnailpath,
|
return os.path.join(self.thumbnailpath,
|
||||||
self.thumbnailprefix + unicode(slide_no) + u'.png')
|
self.thumbnailprefix + unicode(slide_no) + u'.png')
|
||||||
\
|
|
||||||
|
Loading…
Reference in New Issue
Block a user