forked from openlp/openlp
More Presentation Hacks, Remotes gets activation option
This commit is contained in:
parent
c2c4940ca7
commit
b734da3aa6
@ -18,10 +18,11 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from impresscontroller import ImpressController
|
||||
from powerpointcontroller import PowerpointController
|
||||
from messagelistener import MessageListener
|
||||
from mediaitem import PresentationMediaItem
|
||||
from presentationtab import PresentationTab
|
||||
|
||||
|
||||
__all__ = ['PresentationMediaItem', 'PresentationTab',
|
||||
'ImpressController', 'MessageListener']
|
||||
'ImpressController', 'ImpressController', 'PowerpointController', 'MessageListener']
|
||||
|
@ -36,7 +36,7 @@ from PyQt4 import QtCore
|
||||
|
||||
class ImpressController(object):
|
||||
"""
|
||||
Class to contol interactions with Impress Presentations
|
||||
Class to control interactions with Impress Presentations
|
||||
It creates the runtime Environment , Loads the and Closes the Presentation
|
||||
As well as trigggering the correct activities based on the users input
|
||||
"""
|
||||
|
@ -1,14 +1,49 @@
|
||||
from win32com.client import Dispatch
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
"""
|
||||
OpenLP - Open Source Lyrics Projection
|
||||
Copyright (c) 2008 Raoul Snyman
|
||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
try:
|
||||
from win32com.client import Dispatch
|
||||
except:
|
||||
pass
|
||||
import logging
|
||||
|
||||
# PPT API documentation:
|
||||
# http://msdn.microsoft.com/en-us/library/aa269321(office.10).aspx
|
||||
|
||||
|
||||
class PowerPointApp(object):
|
||||
def __init__(self):
|
||||
self.createApp()
|
||||
class PowerpointController(object):
|
||||
"""
|
||||
Class to control interactions with Powerpoint Presentations
|
||||
It creates the runtime Environment , Loads the and Closes the Presentation
|
||||
As well as trigggering the correct activities based on the users input
|
||||
"""
|
||||
global log
|
||||
log = logging.getLogger(u'PowerpointController')
|
||||
|
||||
def createApp(self):
|
||||
def __init__(self):
|
||||
log.debug(u'Initialising')
|
||||
self.process = None
|
||||
self.document = None
|
||||
self.presentation = None
|
||||
self.startPowerpoint()
|
||||
|
||||
def startPowerpoint(self):
|
||||
try:
|
||||
self._app = Dispatch(u'PowerPoint.Application')
|
||||
except:
|
||||
@ -31,13 +66,14 @@ class PowerPointApp(object):
|
||||
def quit(self):
|
||||
self._app.Quit()
|
||||
self._app = None
|
||||
|
||||
|
||||
class PowerPointPres(object):
|
||||
|
||||
def __init__(self, pptApp, filename):
|
||||
self.pptApp = pptApp
|
||||
self.filename = filename
|
||||
self.open()
|
||||
|
||||
|
||||
def getPres(self):
|
||||
if self._pres == None:
|
||||
for p in self.pptApp.app.Presentations:
|
||||
@ -52,9 +88,9 @@ class PowerPointPres(object):
|
||||
if self._pres == None:
|
||||
self.openPres()
|
||||
return self._pres
|
||||
|
||||
|
||||
pres = property(getPres)
|
||||
|
||||
|
||||
def open(self):
|
||||
self.pptApp.app.Presentations.Open(self.filename, False, False, True)
|
||||
self._pres = self.pptApp.app.Presentations(ppt.app.Presentations.Count)
|
||||
@ -82,11 +118,11 @@ class PowerPointPres(object):
|
||||
def blankScreen(self):
|
||||
if self.isActive():
|
||||
self.pres.SlideShowWindow.View.State = 3
|
||||
|
||||
|
||||
def stop(self):
|
||||
if self.isActive():
|
||||
self.pres.SlideShowWindow.View.Exit()
|
||||
|
||||
|
||||
def go(self):
|
||||
self.pres.SlideShowSettings.Run()
|
||||
|
||||
@ -95,13 +131,13 @@ class PowerPointPres(object):
|
||||
return self.pres.SlideShowWindow.View.CurrentShowPosition
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
def setCurrentSlideIndex(self, slideno):
|
||||
if not self.isActive():
|
||||
self.resume()
|
||||
self.pres.SlideShowWindow.View.GotoSlide(slideno)
|
||||
|
||||
currentSlideIndex = property(getSlideNumber, setSlideNumber)
|
||||
#currentSlideIndex = property(getSlideNumber, setSlideNumber)
|
||||
|
||||
def nextStep(self):
|
||||
if not self.isActive():
|
||||
@ -136,4 +172,3 @@ class PowerPointSlide(object):
|
||||
# w.CloseClipboard()
|
||||
return self.preview
|
||||
|
||||
|
@ -1,3 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
"""
|
||||
OpenLP - Open Source Lyrics Projection
|
||||
Copyright (c) 2008 Raoul Snyman
|
||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
|
||||
import sys
|
||||
import win32api
|
||||
from PyQt4 import QtGui, QtCore
|
||||
@ -66,29 +86,29 @@ class BoxLayout(QtGui.QWidget):
|
||||
if self.pptid<0: return
|
||||
pptdll.PrevStep(self.pptid)
|
||||
self.slideEdit.setText(pptdll.GetCurrentSlide(self.pptid))
|
||||
|
||||
|
||||
def NextClick(self):
|
||||
if(self.pptid<0): return
|
||||
pptdll.NextStep(self.pptid)
|
||||
self.slideEdit.setText(pptdll.GetCurrentSlide(self.pptid))
|
||||
|
||||
|
||||
def BlankClick(self):
|
||||
if(self.pptid<0): return
|
||||
pptdll.Blank(self.pptid)
|
||||
|
||||
|
||||
def UnblankClick(self):
|
||||
if(self.pptid<0): return
|
||||
pptdll.Unblank(self.pptid)
|
||||
|
||||
|
||||
def RestartClick(self):
|
||||
if(self.pptid<0): return
|
||||
pptdll.RestartShow(self.pptid)
|
||||
self.slideEdit.setText(pptdll.GetCurrentSlide(self.pptid))
|
||||
|
||||
|
||||
def StopClick(self):
|
||||
if(self.pptid<0): return
|
||||
pptdll.Stop(self.pptid)
|
||||
|
||||
|
||||
def ResumeClick(self):
|
||||
if(self.pptid<0): return
|
||||
pptdll.Resume(self.pptid)
|
||||
|
@ -56,6 +56,10 @@ class PresentationTab(SettingsTab):
|
||||
self.PowerpointCheckBox.setTristate(False)
|
||||
self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox')
|
||||
self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1)
|
||||
self.PowerpointViewerCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
|
||||
self.PowerpointViewerCheckBox.setTristate(False)
|
||||
self.PowerpointViewerCheckBox.setObjectName(u'PowerpointViewerCheckBox')
|
||||
self.VerseDisplayLayout.addWidget(self.PowerpointViewerCheckBox, 1, 0, 1, 1)
|
||||
self.ImpressCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
|
||||
self.ImpressCheckBox.setTristate(False)
|
||||
self.ImpressCheckBox.setObjectName(u'ImpressCheckBox')
|
||||
@ -84,12 +88,15 @@ class PresentationTab(SettingsTab):
|
||||
|
||||
def retranslateUi(self):
|
||||
self.PowerpointCheckBox.setText(translate(u'PresentationTab', 'Powerpoint available:'))
|
||||
self.PowerpointViewerCheckBox.setText(translate(u'PresentationTab', 'PowerpointViewer available:'))
|
||||
self.ImpressCheckBox.setText(translate(u'PresentationTab', 'Impress available:'))
|
||||
|
||||
def load(self):
|
||||
self.PowerpointCheckBox.setChecked(int(self.config.get_config(u'Powerpoint', 0)))
|
||||
self.PowerpointViewerCheckBox.setChecked(int(self.config.get_config(u'Powerpoint Viewer', 0)))
|
||||
self.ImpressCheckBox.setChecked(int(self.config.get_config(u'Impress', 0)))
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'Powerpoint', unicode(self.PowerpointCheckBox.checkState()))
|
||||
self.config.set_config(u'Powerpoint Viewer', unicode(self.PowerpointViewerCheckBox.checkState()))
|
||||
self.config.set_config(u'Impress', unicode(self.ImpressCheckBox.checkState()))
|
||||
|
@ -25,7 +25,8 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Plugin, MediaManagerItem
|
||||
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, ImpressController
|
||||
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, \
|
||||
ImpressController, PowerpointController
|
||||
|
||||
class PresentationPlugin(Plugin):
|
||||
|
||||
@ -74,7 +75,25 @@ class PresentationPlugin(Plugin):
|
||||
openoffice = ImpressController()
|
||||
self.registerControllers(u'Impress', openoffice)
|
||||
except:
|
||||
log.error(u'Reason : %s', sys.exc_info())#[0])
|
||||
log.error(u'Reason : %s', sys.exc_info())
|
||||
#Lets see if Impress is required (Default is Not wanted)
|
||||
if int(self.config.get_config(u'Powerpoint', 0)) == 2:
|
||||
try:
|
||||
#Check to see if we are Win32
|
||||
from win32com.client import Dispatch
|
||||
powerpoint = PowerpointController()
|
||||
self.registerControllers(u'Powerpoint', powerpoint)
|
||||
except:
|
||||
log.error(u'Reason : %s', sys.exc_info())
|
||||
#Lets see if Impress is required (Default is Not wanted)
|
||||
if int(self.config.get_config(u'Powerpoint Viewer', 0)) == 2:
|
||||
try:
|
||||
#Check to see if we are Win32
|
||||
from win32com.client import Dispatch
|
||||
powerpoint = PowerpointController()
|
||||
self.registerControllers(u'Powerpoint Viewer', powerpoint)
|
||||
except:
|
||||
log.error(u'Reason : %s', sys.exc_info())
|
||||
#If we have no available controllers disable plugin
|
||||
if len(self.controllers) > 0:
|
||||
return True
|
||||
|
@ -43,6 +43,9 @@ class RemoteTab(SettingsTab):
|
||||
self.RemotePortSpinBox.setObjectName(u'RemotePortSpinBox')
|
||||
self.RemotePortSpinBox.setMaximum(32767)
|
||||
self.RemoteModeLayout.addWidget(self.RemotePortSpinBox)
|
||||
self.RemoteActive = QtGui.QCheckBox(self.RemoteModeGroupBox)
|
||||
self.RemoteActive.setObjectName(u'RemotePortSpinBox')
|
||||
self.RemoteModeLayout.addWidget(self.RemoteActive)
|
||||
self.WarningLabel = QtGui.QLabel(self.RemoteModeGroupBox)
|
||||
self.WarningLabel.setObjectName(u'WarningLabel')
|
||||
self.RemoteModeLayout.addWidget(self.WarningLabel)
|
||||
@ -50,10 +53,14 @@ class RemoteTab(SettingsTab):
|
||||
|
||||
def retranslateUi(self):
|
||||
self.RemoteModeGroupBox.setTitle(translate(u'RemoteTab', u'Remotes Receiver Port'))
|
||||
self.RemoteActive.setText(translate(u'RemoteTab', 'Remote available:'))
|
||||
self.WarningLabel.setText(translate(u'RemoteTab', u'A restart is needed for this change to become effective'))
|
||||
|
||||
def load(self):
|
||||
self.RemotePortSpinBox.setValue(int(self.config.get_config(u'remote port', 4316)))
|
||||
self.RemoteActive.setChecked(int(self.config.get_config(u'startup', 0)))
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'remote port', unicode(self.RemotePortSpinBox.value()))
|
||||
self.config.set_config(u'startup', unicode(self.RemoteActive.checkState()))
|
||||
|
||||
|
@ -40,6 +40,17 @@ class RemotesPlugin(Plugin):
|
||||
QtCore.QObject.connect(self.server,
|
||||
QtCore.SIGNAL(u'readyRead()'), self.readData)
|
||||
|
||||
def check_pre_conditions(self):
|
||||
"""
|
||||
Check to see if remotes is required
|
||||
"""
|
||||
log.debug('check_pre_conditions')
|
||||
#Lets see if Remote is required
|
||||
if int(self.config.get_config(u'startup', 0)) == 2:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_settings_tab(self):
|
||||
"""
|
||||
Create the settings Tab
|
||||
|
Loading…
Reference in New Issue
Block a user