forked from openlp/openlp
Handle Impress errors better
This commit is contained in:
parent
0b83c7180f
commit
76fd92b01a
@ -145,7 +145,12 @@ class ImpressController(PresentationController):
|
||||
log.debug(u'get COM Desktop OpenOffice')
|
||||
if not self.manager:
|
||||
return None
|
||||
return self.manager.createInstance(u'com.sun.star.frame.Desktop')
|
||||
desktop = None
|
||||
try:
|
||||
desktop = self.manager.createInstance(u'com.sun.star.frame.Desktop')
|
||||
except AttributeError:
|
||||
log.exception(u'Failure to find desktop - Impress may have closed')
|
||||
return desktop if desktop else None
|
||||
|
||||
def get_com_servicemanager(self):
|
||||
"""
|
||||
@ -166,14 +171,17 @@ class ImpressController(PresentationController):
|
||||
log.debug(u'Kill OpenOffice')
|
||||
while self.docs:
|
||||
self.docs[0].close_presentation()
|
||||
if os.name != u'nt':
|
||||
desktop = self.get_uno_desktop()
|
||||
else:
|
||||
desktop = self.get_com_desktop()
|
||||
#Sometimes we get a failure and desktop is None
|
||||
if not desktop:
|
||||
desktop = None
|
||||
try:
|
||||
if os.name != u'nt':
|
||||
desktop = self.get_uno_desktop()
|
||||
else:
|
||||
desktop = self.get_com_desktop()
|
||||
except:
|
||||
log.exception(u'Failed to find an OpenOffice desktop to terminate')
|
||||
return
|
||||
finally:
|
||||
if not desktop:
|
||||
return
|
||||
docs = desktop.getComponents()
|
||||
if docs.hasElements():
|
||||
log.debug(u'OpenOffice not terminated as docs are still open')
|
||||
|
Loading…
Reference in New Issue
Block a user