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