Added another try/catch, try to fix 1303381

Fixes: https://launchpad.net/bugs/1303381
This commit is contained in:
Tomas Groth 2014-06-18 11:35:37 +02:00
parent 8f7c22ecc2
commit 248c0fbf41

View File

@ -250,7 +250,7 @@ class PowerpointDocument(PresentationDocument):
try: try:
return self.presentation.SlideShowWindow.View.State == 3 return self.presentation.SlideShowWindow.View.State == 3
except pywintypes.com_error: except pywintypes.com_error:
log.error(u'COM error while in blank_screen') log.error(u'COM error while in is_blank')
log.error(e) log.error(e)
return False return False
else: else:
@ -287,10 +287,14 @@ class PowerpointDocument(PresentationDocument):
ppt_window = self.presentation.SlideShowSettings.Run() ppt_window = self.presentation.SlideShowSettings.Run()
if not ppt_window: if not ppt_window:
return return
try:
ppt_window.Top = rect.y() * 72 / dpi ppt_window.Top = rect.y() * 72 / dpi
ppt_window.Height = rect.height() * 72 / dpi ppt_window.Height = rect.height() * 72 / dpi
ppt_window.Left = rect.x() * 72 / dpi ppt_window.Left = rect.x() * 72 / dpi
ppt_window.Width = rect.width() * 72 / dpi ppt_window.Width = rect.width() * 72 / dpi
except AttributeError as e:
log.error(u'AttributeError while in start_presentation')
log.error(e)
# Powerpoint 2013 pops up when starting a file, so we minimize it again # Powerpoint 2013 pops up when starting a file, so we minimize it again
if self.presentation.Application.Version == u'15.0': if self.presentation.Application.Version == u'15.0':
self.presentation.ActiveWindow.WindowState = 2 self.presentation.ActiveWindow.WindowState = 2
@ -383,14 +387,13 @@ class PowerpointDocument(PresentationDocument):
def show_error_msg(self): def show_error_msg(self):
""" """
Close presentation and display an error message. Stop presentation and display an error message.
""" """
self.stop_presentation() self.stop_presentation()
self.close_presentation()
critical_error_message_box(UiStrings().Error, translate('PresentationPlugin.PowerpointDocument', critical_error_message_box(UiStrings().Error, translate('PresentationPlugin.PowerpointDocument',
'An error occurred in the Powerpoint integration ' 'An error occurred in the Powerpoint integration '
'and the presentation will be closed. ' 'and the presentation will be stopped. '
'Reload the presentation if you wish to present it.')) 'Relstart the presentation if you wish to present it.'))
def _get_text_from_shapes(shapes): def _get_text_from_shapes(shapes):
""" """