forked from openlp/openlp
SlideController clean up
Image Plugin Cleanup bzr-revno: 511
This commit is contained in:
commit
132990fa78
@ -52,7 +52,7 @@ class OpenLP(QtGui.QApplication):
|
|||||||
pass
|
pass
|
||||||
#provide a listener for widgets to reqest a screen update.
|
#provide a listener for widgets to reqest a screen update.
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'openlpprocessevents'), self.processEvents)
|
QtCore.SIGNAL(u'process_events'), self.processEvents)
|
||||||
self.setApplicationName(u'openlp.org')
|
self.setApplicationName(u'openlp.org')
|
||||||
self.setApplicationVersion(u'1.9.0')
|
self.setApplicationVersion(u'1.9.0')
|
||||||
self.splash = SplashScreen(self.applicationVersion())
|
self.splash = SplashScreen(self.applicationVersion())
|
||||||
|
@ -32,10 +32,6 @@ class EventReceiver(QtCore.QObject):
|
|||||||
def send_message(self, event, msg=None):
|
def send_message(self, event, msg=None):
|
||||||
self.emit(QtCore.SIGNAL(event), msg)
|
self.emit(QtCore.SIGNAL(event), msg)
|
||||||
|
|
||||||
def received(self, msg=None):
|
|
||||||
print msg
|
|
||||||
|
|
||||||
|
|
||||||
class Receiver():
|
class Receiver():
|
||||||
"""
|
"""
|
||||||
Class to allow events to be passed from different parts of the system.
|
Class to allow events to be passed from different parts of the system.
|
||||||
@ -55,10 +51,6 @@ class Receiver():
|
|||||||
def send_message(event, msg=None):
|
def send_message(event, msg=None):
|
||||||
Receiver.eventreceiver.send_message(event, msg)
|
Receiver.eventreceiver.send_message(event, msg)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def receive():
|
|
||||||
Receiver.eventreceiver.receive()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_receiver():
|
def get_receiver():
|
||||||
return Receiver.eventreceiver
|
return Receiver.eventreceiver
|
||||||
|
@ -21,7 +21,7 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from openlp.core.lib import translate, EventManager, Event, EventType
|
from openlp.core.lib import translate, EventManager, Event, EventType, Receiver
|
||||||
|
|
||||||
class MainDisplay(QtGui.QWidget):
|
class MainDisplay(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
@ -60,6 +60,8 @@ class MainDisplay(QtGui.QWidget):
|
|||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
# Register the main form as an event consumer.
|
# Register the main form as an event consumer.
|
||||||
self.parent.EventManager.register(self)
|
self.parent.EventManager.register(self)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
|
||||||
|
|
||||||
def handle_event(self, event):
|
def handle_event(self, event):
|
||||||
"""
|
"""
|
||||||
|
@ -21,7 +21,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import OpenLPToolbar, translate, buildIcon
|
from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver
|
||||||
|
|
||||||
class SlideList(QtGui.QTableWidget):
|
class SlideList(QtGui.QTableWidget):
|
||||||
"""
|
"""
|
||||||
@ -64,9 +64,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
Set up the Slide Controller.
|
Set up the Slide Controller.
|
||||||
"""
|
"""
|
||||||
self.toolbarList = {}
|
self.toolbarList = {}
|
||||||
self.previewList = {}
|
|
||||||
QtGui.QWidget.__init__(self, parent)
|
QtGui.QWidget.__init__(self, parent)
|
||||||
self.isLive = isLive
|
self.isLive = isLive
|
||||||
|
self.prefix = u'preview_'
|
||||||
|
if isLive:
|
||||||
|
self.prefix = u'live_'
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
||||||
self.Splitter = QtGui.QSplitter(self.Panel)
|
self.Splitter = QtGui.QSplitter(self.Panel)
|
||||||
@ -118,118 +120,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.grid.setMargin(8)
|
self.grid.setMargin(8)
|
||||||
self.grid.setObjectName(u'grid')
|
self.grid.setObjectName(u'grid')
|
||||||
# Actual preview screen
|
# Actual preview screen
|
||||||
masterPreview = MasterPreview(self.PreviewFrame).getPreview()
|
|
||||||
self.registerPreview(u'master', masterPreview)
|
|
||||||
self.SlidePreview = self.retrievePreview(u'master')
|
|
||||||
self.grid.addWidget(self.SlidePreview, 0, 0, 1, 1)
|
|
||||||
# Signals
|
|
||||||
QtCore.QObject.connect(self.PreviewListWidget,
|
|
||||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.BaseToolbar.onSlideSelected)
|
|
||||||
QtCore.QObject.connect(self.PreviewListWidget,
|
|
||||||
QtCore.SIGNAL(u'activated(QModelIndex)'), self.BaseToolbar.onSlideSelected)
|
|
||||||
# Add Late Arrivals
|
|
||||||
self.BaseToolbar.PreviewListWidget = self.PreviewListWidget
|
|
||||||
self.BaseToolbar.SlidePreview = self.SlidePreview
|
|
||||||
self.BaseToolbar.mainDisplay = self.parent.mainDisplay
|
|
||||||
|
|
||||||
def registerToolbar(self, handle,controller):
|
|
||||||
"""
|
|
||||||
Register a new toolbar with the controller
|
|
||||||
``handle``
|
|
||||||
Identifier for the toolbar being stored this should equal the
|
|
||||||
plugins name.
|
|
||||||
``controller``
|
|
||||||
The toolbar class which should extend MasterToolbar
|
|
||||||
"""
|
|
||||||
#store the handle name in lower case so no probems later
|
|
||||||
self.toolbarList[handle.lower()] = controller
|
|
||||||
|
|
||||||
def registerPreview(self, handle,controller):
|
|
||||||
"""
|
|
||||||
Register a new preview with the controller
|
|
||||||
``handle``
|
|
||||||
Identifier for the preview being stored this should equal the
|
|
||||||
plugins name.
|
|
||||||
``controller``
|
|
||||||
The preview class which should extend MasterToolbar
|
|
||||||
"""
|
|
||||||
#store the handle name in lower case so no probems later
|
|
||||||
self.previewList[handle.lower()] = controller
|
|
||||||
|
|
||||||
def retrieveToolbar(self, handle):
|
|
||||||
"""
|
|
||||||
Find the toolbar and return master if none present
|
|
||||||
Add extra information back into toolbar class
|
|
||||||
``handle``
|
|
||||||
Identifier for the toolbar being requested
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
toolbar = self.toolbarList[handle.lower()]
|
|
||||||
except:
|
|
||||||
toolbar = self.toolbarList[u'master']
|
|
||||||
toolbar.PreviewListWidget = self.PreviewListWidget
|
|
||||||
toolbar.SlidePreview = self.SlidePreview
|
|
||||||
toolbar.mainDisplay = self.parent.mainDisplay
|
|
||||||
return toolbar
|
|
||||||
|
|
||||||
def retrievePreview(self, handle):
|
|
||||||
"""
|
|
||||||
Find the preview and return master if none present
|
|
||||||
Add extra information back into toolbar class
|
|
||||||
``handle``
|
|
||||||
Identifier for the toolbar being requested
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
preview = self.previewList[handle.lower()]
|
|
||||||
except:
|
|
||||||
preview = self.previewList[u'master']
|
|
||||||
return preview
|
|
||||||
|
|
||||||
def addServiceItem(self, item):
|
|
||||||
"""
|
|
||||||
Method to install the service item into the controller and
|
|
||||||
request the correct the toolbar of the plugin
|
|
||||||
Called by plugins
|
|
||||||
"""
|
|
||||||
self.SlidePreview = self.retrievePreview(item.shortname)
|
|
||||||
self.BaseToolbar = self.retrieveToolbar(item.shortname)
|
|
||||||
self.ControllerLayout.removeWidget(self.Toolbar)
|
|
||||||
#remove the old toolbar
|
|
||||||
self.Toolbar.clear()
|
|
||||||
self.Toolbar = self.BaseToolbar.getToolbar()
|
|
||||||
self.ControllerLayout.addWidget(self.Toolbar)
|
|
||||||
self.BaseToolbar.addServiceItem(item)
|
|
||||||
|
|
||||||
def addServiceManagerItem(self, item, slideno):
|
|
||||||
"""
|
|
||||||
Method to install the service item into the controller and
|
|
||||||
request the correct the toolbar of the plugin
|
|
||||||
Called by ServiceManager
|
|
||||||
"""
|
|
||||||
self.SlidePreview = self.retrievePreview(item.shortname)
|
|
||||||
self.BaseToolbar = self.retrieveToolbar(item.shortname)
|
|
||||||
self.ControllerLayout.removeWidget(self.Toolbar)
|
|
||||||
#remove the old toolbar
|
|
||||||
self.Toolbar.clear()
|
|
||||||
self.Toolbar = self.BaseToolbar.getToolbar()
|
|
||||||
self.ControllerLayout.addWidget(self.Toolbar)
|
|
||||||
self.BaseToolbar.addServiceManagerItem(item, slideno)
|
|
||||||
|
|
||||||
|
|
||||||
class MasterPreview(QtCore.QObject):
|
|
||||||
"""
|
|
||||||
Class from which all Previews should extend allowing plugins to
|
|
||||||
have their own previews
|
|
||||||
"""
|
|
||||||
def __init__(self, parent):
|
|
||||||
self.parent = parent
|
|
||||||
QtCore.QObject.__init__(self)
|
|
||||||
self.definePreview()
|
|
||||||
|
|
||||||
def getPreview(self):
|
|
||||||
return self.SlidePreview
|
|
||||||
|
|
||||||
def definePreview(self):
|
|
||||||
self.SlidePreview = QtGui.QLabel(self.parent)
|
self.SlidePreview = QtGui.QLabel(self.parent)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
||||||
QtGui.QSizePolicy.Fixed)
|
QtGui.QSizePolicy.Fixed)
|
||||||
@ -244,130 +134,82 @@ class MasterPreview(QtCore.QObject):
|
|||||||
self.SlidePreview.setLineWidth(1)
|
self.SlidePreview.setLineWidth(1)
|
||||||
self.SlidePreview.setScaledContents(True)
|
self.SlidePreview.setScaledContents(True)
|
||||||
self.SlidePreview.setObjectName(u'SlidePreview')
|
self.SlidePreview.setObjectName(u'SlidePreview')
|
||||||
|
self.grid.addWidget(self.SlidePreview, 0, 0, 1, 1)
|
||||||
|
# Signals
|
||||||
|
QtCore.QObject.connect(self.PreviewListWidget,
|
||||||
|
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
||||||
|
QtCore.QObject.connect(self.PreviewListWidget,
|
||||||
|
QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
|
||||||
|
# Window Event Handlers
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%sslide_first'% self.prefix), self.onSlideSelectedFirst)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%sslide_previous'% self.prefix), self.onSlideSelectedPrevious)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%sslide_next'% self.prefix), self.onSlideSelectedNext)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%sslide_last'% self.prefix), self.onSlideSelectedLast)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%sslide_start_loop'% self.prefix), self.onStartLoop)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%sslide_stop_loop'% self.prefix), self.onStopLoop)
|
||||||
|
|
||||||
|
|
||||||
class MasterToolbar(QtCore.QObject):
|
def registerToolbar(self, handle,controller):
|
||||||
"""
|
"""
|
||||||
Class from which all toolbars should extend
|
Register a new toolbar with the controller
|
||||||
|
``handle``
|
||||||
|
Identifier for the toolbar being stored this should equal the
|
||||||
|
plugins name.
|
||||||
|
``controller``
|
||||||
|
The toolbar class which should extend MasterToolbar
|
||||||
"""
|
"""
|
||||||
def __init__(self, isLive):
|
#store the handle name in lower case so no probems later
|
||||||
self.Toolbar = None
|
self.toolbarList[handle.lower()] = controller
|
||||||
QtCore.QObject.__init__(self)
|
|
||||||
self.PreviewListWidget = QtGui.QListWidget()
|
|
||||||
self.isLive = isLive
|
|
||||||
|
|
||||||
def getToolbar(self):
|
def retrieveToolbar(self, handle):
|
||||||
#define toolbar here as it needs to be redefined each time
|
"""
|
||||||
#as the clear destroys it.
|
Find the toolbar and return master if none present
|
||||||
self.defineToolbar()
|
Add extra information back into toolbar class
|
||||||
return self.Toolbar
|
``handle``
|
||||||
|
Identifier for the toolbar being requested
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
toolbar = self.toolbarList[handle.lower()]
|
||||||
|
except:
|
||||||
|
toolbar = self.toolbarList[u'master']
|
||||||
|
return toolbar
|
||||||
|
|
||||||
def defineToolbar(self):
|
def addServiceItem(self, item):
|
||||||
# Controller toolbar
|
"""
|
||||||
self.Toolbar = OpenLPToolbar(self)
|
Method to install the service item into the controller and
|
||||||
sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
request the correct the toolbar of the plugin
|
||||||
QtGui.QSizePolicy.Fixed)
|
Called by plugins
|
||||||
sizeToolbarPolicy.setHorizontalStretch(0)
|
"""
|
||||||
sizeToolbarPolicy.setVerticalStretch(0)
|
self.BaseToolbar = self.retrieveToolbar(item.shortname)
|
||||||
sizeToolbarPolicy.setHeightForWidth(
|
self.ControllerLayout.removeWidget(self.Toolbar)
|
||||||
self.Toolbar.sizePolicy().hasHeightForWidth())
|
#remove the old toolbar
|
||||||
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
self.Toolbar.clear()
|
||||||
|
self.Toolbar = self.BaseToolbar.getToolbar()
|
||||||
|
self.ControllerLayout.addWidget(self.Toolbar)
|
||||||
|
item.render()
|
||||||
|
self.displayServiceManagerItems(item, 0)
|
||||||
|
|
||||||
if self.isLive:
|
def addServiceManagerItem(self, item, slideno):
|
||||||
self.Toolbar.addToolbarButton(u'First Slide',
|
"""
|
||||||
u':/slides/slide_first.png',
|
Method to install the service item into the controller and
|
||||||
translate(u'SlideController', u'Move to first'),
|
request the correct the toolbar of the plugin
|
||||||
self.onSlideSelectedFirst)
|
Called by ServiceManager
|
||||||
self.Toolbar.addToolbarButton(u'Previous Slide',
|
"""
|
||||||
u':/slides/slide_previous.png',
|
self.BaseToolbar = self.retrieveToolbar(item.shortname)
|
||||||
translate(u'SlideController', u'Move to previous'),
|
self.ControllerLayout.removeWidget(self.Toolbar)
|
||||||
self.onSlideSelectedPrevious)
|
#remove the old toolbar
|
||||||
self.Toolbar.addToolbarButton(u'Next Slide',
|
self.Toolbar.clear()
|
||||||
u':/slides/slide_next.png',
|
self.Toolbar = self.BaseToolbar.getToolbar()
|
||||||
translate(u'SlideController', u'Move to next'),
|
self.ControllerLayout.addWidget(self.Toolbar)
|
||||||
self.onSlideSelectedNext)
|
self.displayServiceManagerItems(item, slideno)
|
||||||
if self.isLive:
|
|
||||||
self.Toolbar.addToolbarButton(u'Last Slide',
|
|
||||||
u':/slides/slide_last.png',
|
|
||||||
translate(u'SlideController', u'Move to last'),
|
|
||||||
self.onSlideSelectedLast)
|
|
||||||
self.Toolbar.addSeparator()
|
|
||||||
self.Toolbar.addToolbarButton(u'Close Screen',
|
|
||||||
u':/slides/slide_close.png',
|
|
||||||
translate(u'SlideController', u'Close Screen'),
|
|
||||||
self.onBlankScreen)
|
|
||||||
|
|
||||||
def serviceLoaded(self):
|
def displayServiceManagerItems(self, serviceitem, slideno):
|
||||||
"""
|
|
||||||
method to allow toolbars to know when the service item
|
|
||||||
is fully in place
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def onSlideSelectedFirst(self):
|
|
||||||
"""
|
|
||||||
Go to the first slide.
|
|
||||||
"""
|
|
||||||
self.PreviewListWidget.selectRow(0)
|
|
||||||
self.onSlideSelected()
|
|
||||||
|
|
||||||
def onSlideSelectedNext(self):
|
|
||||||
"""
|
|
||||||
Go to the next slide.
|
|
||||||
"""
|
|
||||||
row = self.PreviewListWidget.currentRow() + 1
|
|
||||||
if row == self.PreviewListWidget.rowCount():
|
|
||||||
row = 0
|
|
||||||
self.PreviewListWidget.selectRow(row)
|
|
||||||
self.onSlideSelected()
|
|
||||||
|
|
||||||
def onSlideSelectedPrevious(self):
|
|
||||||
"""
|
|
||||||
Go to the previous slide.
|
|
||||||
"""
|
|
||||||
row = self.PreviewListWidget.currentRow() - 1
|
|
||||||
if row == -1:
|
|
||||||
row = self.PreviewListWidget.rowCount() - 1
|
|
||||||
self.PreviewListWidget.selectRow(row)
|
|
||||||
self.onSlideSelected()
|
|
||||||
|
|
||||||
def onSlideSelectedLast(self):
|
|
||||||
"""
|
|
||||||
Go to the last slide.
|
|
||||||
"""
|
|
||||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
|
|
||||||
self.onSlideSelected()
|
|
||||||
|
|
||||||
def onBlankScreen(self):
|
|
||||||
"""
|
|
||||||
Blank the screen.
|
|
||||||
"""
|
|
||||||
self.mainDisplay.blankDisplay()
|
|
||||||
|
|
||||||
def onSlideSelected(self):
|
|
||||||
"""
|
|
||||||
Generate the preview when you click on a slide.
|
|
||||||
if this is the Live Controller also display on the screen
|
|
||||||
"""
|
|
||||||
row = self.PreviewListWidget.currentRow()
|
|
||||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
|
||||||
label = self.PreviewListWidget.cellWidget(row, 0)
|
|
||||||
smallframe = label.pixmap()
|
|
||||||
frame = self.serviceitem.frames[row][u'image']
|
|
||||||
self.SlidePreview.setPixmap(smallframe)
|
|
||||||
if self.isLive:
|
|
||||||
self.mainDisplay.frameView(frame)
|
|
||||||
|
|
||||||
def addServiceItem(self, serviceitem, slideno = 1):
|
|
||||||
"""
|
|
||||||
Loads a ServiceItem into the system from plugins
|
|
||||||
Display the first slide
|
|
||||||
"""
|
|
||||||
log.debug(u'add Service Item')
|
|
||||||
serviceitem.render()
|
|
||||||
self.addServiceManagerItem(serviceitem, 0)
|
|
||||||
|
|
||||||
def addServiceManagerItem(self, serviceitem, slideno):
|
|
||||||
"""
|
"""
|
||||||
Loads a ServiceItem into the system from ServiceManager
|
Loads a ServiceItem into the system from ServiceManager
|
||||||
Display the slide number passed
|
Display the slide number passed
|
||||||
@ -398,5 +240,177 @@ class MasterToolbar(QtCore.QObject):
|
|||||||
else:
|
else:
|
||||||
self.PreviewListWidget.selectRow(slideno)
|
self.PreviewListWidget.selectRow(slideno)
|
||||||
self.onSlideSelected()
|
self.onSlideSelected()
|
||||||
self.serviceLoaded()
|
|
||||||
self.PreviewListWidget.setFocus()
|
self.PreviewListWidget.setFocus()
|
||||||
|
|
||||||
|
#Screen event methods
|
||||||
|
def onSlideSelected(self):
|
||||||
|
"""
|
||||||
|
Generate the preview when you click on a slide.
|
||||||
|
if this is the Live Controller also display on the screen
|
||||||
|
"""
|
||||||
|
row = self.PreviewListWidget.currentRow()
|
||||||
|
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||||
|
label = self.PreviewListWidget.cellWidget(row, 0)
|
||||||
|
smallframe = label.pixmap()
|
||||||
|
frame = self.serviceitem.frames[row][u'image']
|
||||||
|
self.SlidePreview.setPixmap(smallframe)
|
||||||
|
if self.isLive:
|
||||||
|
self.parent.mainDisplay.frameView(frame)
|
||||||
|
|
||||||
|
def onSlideSelectedFirst(self):
|
||||||
|
"""
|
||||||
|
Go to the first slide.
|
||||||
|
"""
|
||||||
|
print "oSSF"
|
||||||
|
self.PreviewListWidget.selectRow(0)
|
||||||
|
self.onSlideSelected()
|
||||||
|
|
||||||
|
def onBlankScreen(self):
|
||||||
|
"""
|
||||||
|
Blank the screen.
|
||||||
|
"""
|
||||||
|
self.parent.mainDisplay.blankDisplay()
|
||||||
|
|
||||||
|
def onSlideSelected(self):
|
||||||
|
"""
|
||||||
|
Generate the preview when you click on a slide.
|
||||||
|
if this is the Live Controller also display on the screen
|
||||||
|
"""
|
||||||
|
row = self.PreviewListWidget.currentRow()
|
||||||
|
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||||
|
label = self.PreviewListWidget.cellWidget(row, 0)
|
||||||
|
smallframe = label.pixmap()
|
||||||
|
frame = self.serviceitem.frames[row][u'image']
|
||||||
|
self.SlidePreview.setPixmap(smallframe)
|
||||||
|
if self.isLive:
|
||||||
|
self.parent.mainDisplay.frameView(frame)
|
||||||
|
|
||||||
|
def onSlideSelectedNext(self):
|
||||||
|
"""
|
||||||
|
Go to the next slide.
|
||||||
|
"""
|
||||||
|
row = self.PreviewListWidget.currentRow() + 1
|
||||||
|
if row == self.PreviewListWidget.rowCount():
|
||||||
|
row = 0
|
||||||
|
self.PreviewListWidget.selectRow(row)
|
||||||
|
self.onSlideSelected()
|
||||||
|
|
||||||
|
def onSlideSelectedPrevious(self):
|
||||||
|
"""
|
||||||
|
Go to the previous slide.
|
||||||
|
"""
|
||||||
|
row = self.PreviewListWidget.currentRow() - 1
|
||||||
|
if row == -1:
|
||||||
|
row = self.PreviewListWidget.rowCount() - 1
|
||||||
|
self.PreviewListWidget.selectRow(row)
|
||||||
|
self.onSlideSelected()
|
||||||
|
|
||||||
|
def onSlideSelectedLast(self):
|
||||||
|
"""
|
||||||
|
Go to the last slide.
|
||||||
|
"""
|
||||||
|
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
|
||||||
|
self.onSlideSelected()
|
||||||
|
|
||||||
|
def onStartLoop(self, value):
|
||||||
|
"""
|
||||||
|
Go to the last slide.
|
||||||
|
"""
|
||||||
|
if self.PreviewListWidget.rowCount() > 1:
|
||||||
|
self.timer_id = self.startTimer(int(value) * 1000)
|
||||||
|
|
||||||
|
def onStopLoop(self):
|
||||||
|
"""
|
||||||
|
Go to the last slide.
|
||||||
|
"""
|
||||||
|
self.killTimer(self.timer_id)
|
||||||
|
|
||||||
|
def timerEvent(self, event):
|
||||||
|
if event.timerId() == self.timer_id:
|
||||||
|
self.onSlideSelectedNext()
|
||||||
|
|
||||||
|
class MasterToolbar(QtCore.QObject):
|
||||||
|
"""
|
||||||
|
Class from which all toolbars should extend
|
||||||
|
"""
|
||||||
|
def __init__(self, isLive):
|
||||||
|
self.Toolbar = None
|
||||||
|
QtCore.QObject.__init__(self)
|
||||||
|
self.PreviewListWidget = QtGui.QListWidget()
|
||||||
|
self.isLive = isLive
|
||||||
|
self.prefix = u'preview_'
|
||||||
|
if isLive:
|
||||||
|
self.prefix = u'live_'
|
||||||
|
|
||||||
|
def getToolbar(self):
|
||||||
|
#define toolbar here as it needs to be redefined each time
|
||||||
|
#as the clear destroys it.
|
||||||
|
self.defineToolbar()
|
||||||
|
self.defineZone1()
|
||||||
|
self.defineZone2()
|
||||||
|
self.defineZone3()
|
||||||
|
self.defineZone4()
|
||||||
|
self.defineZone5()
|
||||||
|
return self.Toolbar
|
||||||
|
|
||||||
|
def defineToolbar(self):
|
||||||
|
# Controller toolbar
|
||||||
|
self.Toolbar = OpenLPToolbar(self)
|
||||||
|
sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
||||||
|
QtGui.QSizePolicy.Fixed)
|
||||||
|
sizeToolbarPolicy.setHorizontalStretch(0)
|
||||||
|
sizeToolbarPolicy.setVerticalStretch(0)
|
||||||
|
sizeToolbarPolicy.setHeightForWidth(
|
||||||
|
self.Toolbar.sizePolicy().hasHeightForWidth())
|
||||||
|
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
||||||
|
|
||||||
|
def defineZone1(self):
|
||||||
|
#Dummy Zone
|
||||||
|
pass
|
||||||
|
|
||||||
|
def defineZone2(self):
|
||||||
|
if self.isLive:
|
||||||
|
self.Toolbar.addToolbarButton(u'First Slide',
|
||||||
|
u':/slides/slide_first.png',
|
||||||
|
translate(u'SlideController', u'Move to first'),
|
||||||
|
self.onSlideFirst)
|
||||||
|
self.Toolbar.addToolbarButton(u'Previous Slide',
|
||||||
|
u':/slides/slide_previous.png',
|
||||||
|
translate(u'SlideController', u'Move to previous'),
|
||||||
|
self.onSlidePrevious)
|
||||||
|
self.Toolbar.addToolbarButton(u'Next Slide',
|
||||||
|
u':/slides/slide_next.png',
|
||||||
|
translate(u'SlideController', u'Move to next'),
|
||||||
|
self.onSlideNext)
|
||||||
|
if self.isLive:
|
||||||
|
self.Toolbar.addToolbarButton(u'Last Slide',
|
||||||
|
u':/slides/slide_last.png',
|
||||||
|
translate(u'SlideController', u'Move to last'),
|
||||||
|
self.onSlideLast)
|
||||||
|
|
||||||
|
def defineZone3(self):
|
||||||
|
#Dummy Zone
|
||||||
|
pass
|
||||||
|
|
||||||
|
def defineZone4(self):
|
||||||
|
if self.isLive:
|
||||||
|
self.Toolbar.addSeparator()
|
||||||
|
self.Toolbar.addToolbarButton(u'Close Screen',
|
||||||
|
u':/slides/slide_close.png',
|
||||||
|
translate(u'SlideController', u'Close Screen'),
|
||||||
|
self.onSlideBlank)
|
||||||
|
|
||||||
|
def defineZone5(self):
|
||||||
|
#Dummy Zone
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onSlideFirst(self):
|
||||||
|
Receiver().send_message(u'%sslide_first'% self.prefix)
|
||||||
|
def onSlidePrevious(self):
|
||||||
|
Receiver().send_message(u'%sslide_previous'% self.prefix)
|
||||||
|
def onSlideNext(self):
|
||||||
|
Receiver().send_message(u'%sslide_next'% self.prefix)
|
||||||
|
def onSlideLast(self):
|
||||||
|
Receiver().send_message(u'%sslide_last' % self.prefix)
|
||||||
|
def onSlideBlank(self):
|
||||||
|
Receiver().send_message(u'%sslide_blank' % self.prefix)
|
||||||
|
@ -60,7 +60,7 @@ class BibleCSVImpl(BibleCommon):
|
|||||||
count += 1
|
count += 1
|
||||||
#Flush the screen events
|
#Flush the screen events
|
||||||
if count % 3 == 0:
|
if count % 3 == 0:
|
||||||
Receiver().send_message(u'openlpprocessevents')
|
Receiver().send_message(u'process_events')
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@ -83,5 +83,5 @@ class BibleCSVImpl(BibleCommon):
|
|||||||
count += 1
|
count += 1
|
||||||
#Every x verses repaint the screen
|
#Every x verses repaint the screen
|
||||||
if count % 3 == 0:
|
if count % 3 == 0:
|
||||||
Receiver().send_message(u'openlpprocessevents')
|
Receiver().send_message(u'process_events')
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -149,13 +149,13 @@ class BibleOSISImpl():
|
|||||||
self.abbrevOfBible[p[0]], testament)
|
self.abbrevOfBible[p[0]], testament)
|
||||||
dialogobject.incrementProgressBar(
|
dialogobject.incrementProgressBar(
|
||||||
self.booksOfBible[p[0]])
|
self.booksOfBible[p[0]])
|
||||||
Receiver().send_message(u'openlpprocessevents')
|
Receiver().send_message(u'process_events')
|
||||||
count = 0
|
count = 0
|
||||||
self.bibledb.add_verse(book.id, p[1], p[2], text)
|
self.bibledb.add_verse(book.id, p[1], p[2], text)
|
||||||
count += 1
|
count += 1
|
||||||
#Every 3 verses repaint the screen
|
#Every 3 verses repaint the screen
|
||||||
if count % 3 == 0:
|
if count % 3 == 0:
|
||||||
Receiver().send_message(u'openlpprocessevents')
|
Receiver().send_message(u'process_events')
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
def remove_block(self, start_tag, end_tag, text):
|
def remove_block(self, start_tag, end_tag, text):
|
||||||
|
@ -252,7 +252,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def setQuickMsg2(self, text):
|
def setQuickMsg2(self, text):
|
||||||
self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text)))
|
self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text)))
|
||||||
Receiver().send_message(u'openlpprocessevents')
|
Receiver().send_message(u'process_events')
|
||||||
#minor delay to get the events processed
|
#minor delay to get the events processed
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
@ -18,5 +18,5 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
from mediaitem import ImageMediaItem
|
from mediaitem import ImageMediaItem
|
||||||
from imageslidecontroller import ImageToolbar
|
from imagetoolbar import ImageToolbar
|
||||||
from imagetab import ImageTab
|
from imagetab import ImageTab
|
||||||
|
@ -1,106 +0,0 @@
|
|||||||
# -*- 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 logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
from openlp.core.lib import OpenLPToolbar, translate
|
|
||||||
from openlp.core.ui.slidecontroller import MasterToolbar
|
|
||||||
|
|
||||||
class ImageToolbar(MasterToolbar):
|
|
||||||
|
|
||||||
def __init__(self, parent, isLive):
|
|
||||||
MasterToolbar.__init__(self, isLive)
|
|
||||||
self.parent = parent
|
|
||||||
self.Toolbar = None
|
|
||||||
self.isLive = isLive
|
|
||||||
self.defineToolbar()
|
|
||||||
|
|
||||||
def defineToolbar(self):
|
|
||||||
# Controller toolbar
|
|
||||||
self.Toolbar = OpenLPToolbar(self)
|
|
||||||
sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizeToolbarPolicy.setHorizontalStretch(0)
|
|
||||||
sizeToolbarPolicy.setVerticalStretch(0)
|
|
||||||
sizeToolbarPolicy.setHeightForWidth(
|
|
||||||
self.Toolbar.sizePolicy().hasHeightForWidth())
|
|
||||||
if self.isLive:
|
|
||||||
self.Toolbar.addToolbarButton(u'First Slide',
|
|
||||||
u':/slides/slide_first.png',
|
|
||||||
translate(u'SlideController', u'Move to first'),
|
|
||||||
self.onSlideSelectedFirst)
|
|
||||||
self.Toolbar.addToolbarButton(u'Previous Slide',
|
|
||||||
u':/slides/slide_previous.png',
|
|
||||||
translate(u'SlideController', u'Move to previous'),
|
|
||||||
self.onSlideSelectedPrevious)
|
|
||||||
self.Toolbar.addToolbarButton(u'Next Slide',
|
|
||||||
u':/slides/slide_next.png',
|
|
||||||
translate(u'SlideController', u'Move to next'),
|
|
||||||
self.onSlideSelectedNext)
|
|
||||||
if self.isLive:
|
|
||||||
self.Toolbar.addToolbarButton(u'Last Slide',
|
|
||||||
u':/slides/slide_last.png',
|
|
||||||
translate(u'SlideController', u'Move to last'),
|
|
||||||
self.onSlideSelectedLast)
|
|
||||||
self.Toolbar.addSeparator()
|
|
||||||
self.Toolbar.addToolbarButton(u'Close Screen',
|
|
||||||
u':/slides/slide_close.png',
|
|
||||||
translate(u'SlideController', u'Close Screen'),
|
|
||||||
self.onBlankScreen)
|
|
||||||
self.Toolbar.addSeparator()
|
|
||||||
self.Toolbar.addToolbarButton(u'Start Loop',
|
|
||||||
u':/media/media_time.png',
|
|
||||||
translate(u'SlideController', u'Start continuous loop'),
|
|
||||||
self.onStartLoop)
|
|
||||||
self.Toolbar.addToolbarButton(u'Stop Loop',
|
|
||||||
u':/media/media_stop.png',
|
|
||||||
translate(u'SlideController', u'Stop continuous loop'),
|
|
||||||
self.onStopLoop)
|
|
||||||
self.Toolbar.addSeparator()
|
|
||||||
self.DelaySpinBox = QtGui.QSpinBox(self.Toolbar)
|
|
||||||
self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
|
|
||||||
self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
|
|
||||||
self.Toolbar.addAction(self.SpinWidget)
|
|
||||||
#self.Layout.addWidget(self.Toolbar)
|
|
||||||
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
|
||||||
self.DelaySpinBox.setSuffix(translate(u'ImageSlideController', u's'))
|
|
||||||
|
|
||||||
def serviceLoaded(self):
|
|
||||||
self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
|
|
||||||
if self.PreviewListWidget.rowCount() == 1:
|
|
||||||
self.DelaySpinBox.setEnabled(False)
|
|
||||||
|
|
||||||
def onStartLoop(self):
|
|
||||||
"""
|
|
||||||
Go to the last slide.
|
|
||||||
"""
|
|
||||||
if self.PreviewListWidget.rowCount() > 1:
|
|
||||||
self.timer_id = self.startTimer(int(self.TimeoutSpinBox.value()) * 1000)
|
|
||||||
|
|
||||||
def onStopLoop(self):
|
|
||||||
"""
|
|
||||||
Go to the last slide.
|
|
||||||
"""
|
|
||||||
self.killTimer(self.timer_id)
|
|
||||||
|
|
||||||
def timerEvent(self, event):
|
|
||||||
if event.timerId() == self.timer_id:
|
|
||||||
self.onSlideSelectedNext()
|
|
63
openlp/plugins/images/lib/imagetoolbar.py
Normal file
63
openlp/plugins/images/lib/imagetoolbar.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# -*- 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 logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
from openlp.core.lib import OpenLPToolbar, translate, Receiver
|
||||||
|
from openlp.core.ui.slidecontroller import MasterToolbar
|
||||||
|
|
||||||
|
class ImageToolbar(MasterToolbar):
|
||||||
|
|
||||||
|
def __init__(self, parent, isLive):
|
||||||
|
MasterToolbar.__init__(self, isLive)
|
||||||
|
self.parent = parent
|
||||||
|
self.Toolbar = None
|
||||||
|
self.isLive = isLive
|
||||||
|
|
||||||
|
def defineZone5(self):
|
||||||
|
self.Toolbar.addSeparator()
|
||||||
|
self.Toolbar.addToolbarButton(u'Start Loop',
|
||||||
|
u':/media/media_time.png',
|
||||||
|
translate(u'SlideController', u'Start continuous loop'),
|
||||||
|
self.onStartLoop)
|
||||||
|
self.Toolbar.addToolbarButton(u'Stop Loop',
|
||||||
|
u':/media/media_stop.png',
|
||||||
|
translate(u'SlideController', u'Stop continuous loop'),
|
||||||
|
self.onStopLoop)
|
||||||
|
self.Toolbar.addSeparator()
|
||||||
|
self.DelaySpinBox = QtGui.QSpinBox(self.Toolbar)
|
||||||
|
self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
|
||||||
|
self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
|
||||||
|
self.Toolbar.addAction(self.SpinWidget)
|
||||||
|
self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
|
||||||
|
self.DelaySpinBox.setSuffix(translate(u'ImageSlideController', u's'))
|
||||||
|
|
||||||
|
def onStartLoop(self):
|
||||||
|
"""
|
||||||
|
Trigger the slide controller to start to loop passing the delay
|
||||||
|
"""
|
||||||
|
Receiver().send_message(u'%sslide_start_loop' % self.prefix, self.DelaySpinBox.value())
|
||||||
|
|
||||||
|
def onStopLoop(self):
|
||||||
|
"""
|
||||||
|
Trigger the slide controller to stop the loop
|
||||||
|
"""
|
||||||
|
Receiver().send_message(u'%sslide_stop_loop' % self.prefix)
|
@ -22,7 +22,7 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD, buildIcon
|
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD, buildIcon
|
||||||
from openlp.plugins.images.lib.imageslidecontroller import ImageToolbar
|
from openlp.plugins.images.lib.imagetoolbar import ImageToolbar
|
||||||
|
|
||||||
# We have to explicitly create separate classes for each plugin
|
# We have to explicitly create separate classes for each plugin
|
||||||
# in order for DnD to the Service manager to work correctly.
|
# in order for DnD to the Service manager to work correctly.
|
||||||
@ -54,7 +54,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
# be instanced by the base MediaManagerItem
|
# be instanced by the base MediaManagerItem
|
||||||
self.ListViewWithDnD_class = ImageListView
|
self.ListViewWithDnD_class = ImageListView
|
||||||
self.ServiceItemIconName = u':/media/media_image.png'
|
self.ServiceItemIconName = u':/media/media_image.png'
|
||||||
|
self.servicePath = None
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
#create and install our own slide controller toolbar
|
#create and install our own slide controller toolbar
|
||||||
imageToolbar = ImageToolbar(self, True)
|
imageToolbar = ImageToolbar(self, True)
|
||||||
@ -63,21 +63,37 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||||
self.ListView.setIconSize(QtCore.QSize(88,50))
|
self.ListView.setIconSize(QtCore.QSize(88,50))
|
||||||
|
self.servicePath = os.path.join(self.parent.config.get_data_path(), u'.thumbnails')
|
||||||
|
if os.path.exists(self.servicePath) == False:
|
||||||
|
os.mkdir(self.servicePath)
|
||||||
self.loadList(self.parent.config.load_list(self.ConfigSection))
|
self.loadList(self.parent.config.load_list(self.ConfigSection))
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
|
try:
|
||||||
|
os.remove(os.path.join(self.servicePath, unicode(item.text())))
|
||||||
|
except:
|
||||||
|
#if not present do not worry
|
||||||
|
pass
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
row = self.ListView.row(item)
|
row = self.ListView.row(item)
|
||||||
self.ListView.takeItem(row)
|
self.ListView.takeItem(row)
|
||||||
self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
|
self.parent.config.set_list(self.ConfigSection, self.getFileList())
|
||||||
|
|
||||||
def loadList(self, list):
|
def loadList(self, list):
|
||||||
for file in list:
|
for file in list:
|
||||||
(path, filename) = os.path.split(unicode(file))
|
(path, filename) = os.path.split(unicode(file))
|
||||||
|
thumb = os.path.join(self.servicePath, filename)
|
||||||
|
if os.path.exists(thumb):
|
||||||
|
icon = buildIcon(thumb)
|
||||||
|
else:
|
||||||
|
icon = buildIcon(unicode(file))
|
||||||
|
pixmap = icon.pixmap(QtCore.QSize(88,50))
|
||||||
|
ext = os.path.splitext(thumb)[1].lower()
|
||||||
|
pixmap.save(thumb, ext[1:])
|
||||||
item_name = QtGui.QListWidgetItem(filename)
|
item_name = QtGui.QListWidgetItem(filename)
|
||||||
item_name.setIcon(buildIcon(file))
|
item_name.setIcon(icon)
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||||
self.ListView.addItem(item_name)
|
self.ListView.addItem(item_name)
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ def main():
|
|||||||
help="Action to be undertaken")
|
help="Action to be undertaken")
|
||||||
parser.add_option("-m", "--message",
|
parser.add_option("-m", "--message",
|
||||||
help="Message to be passed for the action")
|
help="Message to be passed for the action")
|
||||||
|
parser.add_option("-n", "--slidenext",
|
||||||
|
help="Trigger the next slide")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
@ -62,6 +64,11 @@ def main():
|
|||||||
elif options.address is None:
|
elif options.address is None:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
parser.error("IP address missing")
|
parser.error("IP address missing")
|
||||||
|
elif options.slidenext is not None:
|
||||||
|
options.event = u'next_slide'
|
||||||
|
options.message = u''
|
||||||
|
text = format_message(options)
|
||||||
|
sendData(options, text)
|
||||||
else:
|
else:
|
||||||
text = format_message(options)
|
text = format_message(options)
|
||||||
sendData(options, text)
|
sendData(options, text)
|
||||||
|
@ -22,7 +22,7 @@ import sys
|
|||||||
|
|
||||||
from PyQt4 import QtNetwork, QtGui, QtCore
|
from PyQt4 import QtNetwork, QtGui, QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, Event, EventType
|
from openlp.core.lib import Plugin, Event, EventType, Receiver
|
||||||
from openlp.plugins.remotes.lib import RemoteTab
|
from openlp.plugins.remotes.lib import RemoteTab
|
||||||
|
|
||||||
class RemotesPlugin(Plugin):
|
class RemotesPlugin(Plugin):
|
||||||
@ -59,7 +59,8 @@ class RemotesPlugin(Plugin):
|
|||||||
|
|
||||||
if event == u'alert':
|
if event == u'alert':
|
||||||
self.event_manager.post_event(Event(u'RemotePlugin', EventType.TriggerAlert , unicode(datagram[pos + 1:])))
|
self.event_manager.post_event(Event(u'RemotePlugin', EventType.TriggerAlert , unicode(datagram[pos + 1:])))
|
||||||
|
if event == u'next_slide':
|
||||||
|
Receiver().send_message(u'live_slide_next')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user