Trap presentation errors when OpenOffice.org is not installed

bzr-revno: 892
This commit is contained in:
Jonathan Corwin 2010-06-28 07:35:06 +01:00
commit b9896bb915

View File

@ -41,9 +41,14 @@ from openlp.core.lib import resize_image
if os.name == u'nt': if os.name == u'nt':
from win32com.client import Dispatch from win32com.client import Dispatch
import pywintypes
else: else:
try:
import uno import uno
from com.sun.star.beans import PropertyValue from com.sun.star.beans import PropertyValue
uno_available = True
except ImportError:
uno_available = False
from PyQt4 import QtCore from PyQt4 import QtCore
@ -78,9 +83,7 @@ class ImpressController(PresentationController):
if os.name == u'nt': if os.name == u'nt':
return self.get_com_servicemanager() is not None return self.get_com_servicemanager() is not None
else: else:
# If not windows, and we've got this far then probably return uno_available
# installed else the import uno would likely have failed
return True
def start_process(self): def start_process(self):
""" """
@ -322,7 +325,10 @@ class ImpressDocument(PresentationDocument):
Returns true if screen is blank Returns true if screen is blank
""" """
log.debug(u'is blank OpenOffice') log.debug(u'is blank OpenOffice')
if self.control:
return self.control.isPaused() return self.control.isPaused()
else:
return False
def stop_presentation(self): def stop_presentation(self):
log.debug(u'stop presentation OpenOffice') log.debug(u'stop presentation OpenOffice')