Minor adjustments

This commit is contained in:
Jonathan Corwin 2009-09-24 08:35:30 +01:00
parent 4ca4fa8f23
commit 6421f1d493
2 changed files with 29 additions and 29 deletions

View File

@ -23,14 +23,12 @@
############################################################################### ###############################################################################
import logging import logging
import os , subprocess import os, subprocess
import time import time
import sys import sys
import win32api
if os.name == u'nt': from ctypes import *
import win32api from ctypes.wintypes import RECT
from ctypes import *
from ctypes.wintypes import RECT
from PyQt4 import QtCore from PyQt4 import QtCore

View File

@ -31,11 +31,12 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, MediaManagerItem from openlp.core.lib import Plugin, MediaManagerItem
from openlp.plugins.presentations.lib import PresentationMediaItem, \ from openlp.plugins.presentations.lib import PresentationMediaItem, \
PresentationTab, ImpressController PresentationTab, ImpressController
try: if os.name == u'nt':
from openlp.plugins.presentations.lib import PowerpointController try:
except: from openlp.plugins.presentations.lib import PowerpointController
pass except:
from openlp.plugins.presentations.lib import PptviewController pass
from openlp.plugins.presentations.lib import PptviewController
class PresentationPlugin(Plugin): class PresentationPlugin(Plugin):
@ -92,24 +93,25 @@ class PresentationPlugin(Plugin):
self.registerControllers(u'Impress', openoffice) self.registerControllers(u'Impress', openoffice)
except: except:
log.exception(u'Failed to set up plugin for Impress') log.exception(u'Failed to set up plugin for Impress')
#Lets see if Powerpoint is required (Default is Not wanted) if os.name == u'nt':
if int(self.config.get_config( #Lets see if Powerpoint is required (Default is Not wanted)
u'Powerpoint', QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: if int(self.config.get_config(
try: u'Powerpoint', QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
#Check to see if we are Win32 try:
from win32com.client import Dispatch #Check to see if we are Win32
powerpoint = PowerpointController() from win32com.client import Dispatch
self.registerControllers(u'Powerpoint', powerpoint) powerpoint = PowerpointController()
except: self.registerControllers(u'Powerpoint', powerpoint)
log.exception(u'Failed to set up plugin for Powerpoint') except:
#Lets see if Powerpoint Viewer is required (Default is Not wanted) log.exception(u'Failed to set up plugin for Powerpoint')
if int(self.config.get_config( #Lets see if Powerpoint Viewer is required (Default is Not wanted)
u'Powerpoint Viewer', QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: if int(self.config.get_config(
try: u'Powerpoint Viewer', QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
pptview = PptviewController() try:
self.registerControllers(u'Powerpoint Viewer', pptview) pptview = PptviewController()
except: self.registerControllers(u'Powerpoint Viewer', pptview)
log.exception(u'Failed to set up plugin for Powerpoint Viewer') except:
log.exception(u'Failed to set up plugin for Powerpoint Viewer')
#If we have no available controllers disable plugin #If we have no available controllers disable plugin
if len(self.controllers) > 0: if len(self.controllers) > 0:
return True return True