forked from openlp/openlp
Start to add the menu items to slide controller
This commit is contained in:
parent
6df0649fbc
commit
c06b64fdbe
@ -23,6 +23,7 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
@ -103,6 +104,7 @@ class MainDisplay(DisplayLabel):
|
||||
self.alertactive = False
|
||||
self.alertTab = None
|
||||
self.timer_id = 0
|
||||
self.firstTime = True
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -111,8 +113,17 @@ class MainDisplay(DisplayLabel):
|
||||
QtCore.SIGNAL(u'presentations_start'), self.hideDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'presentations_stop'), self.showDisplay)
|
||||
QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'finished()'),
|
||||
self.onMediaFinish)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'finished()'), self.onMediaFinish)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_start'), self.onMediaQueue)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_play'), self.onMediaPlay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_pause'), self.onMediaPaws)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_stop'), self.onMediaFinish)
|
||||
|
||||
|
||||
def setup(self, screenNumber):
|
||||
"""
|
||||
@ -233,26 +244,28 @@ class MainDisplay(DisplayLabel):
|
||||
self.killTimer(self.timer_id)
|
||||
self.timer_id = 0
|
||||
|
||||
def queueMedia(self, item, firstItem=True):
|
||||
if firstItem:
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(item))
|
||||
else:
|
||||
self.mediaObject.enqueue(Phonon.MediaSource(item))
|
||||
|
||||
def playMedia(self):
|
||||
def onMediaQueue(self, message):
|
||||
self.display.close()
|
||||
file = os.path.join(message[1], message[2])
|
||||
if self.firstTime:
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
|
||||
self.firstTime = False
|
||||
else:
|
||||
self.mediaObject.enqueue(Phonon.MediaSource(file))
|
||||
|
||||
def onMediaPlay(self):
|
||||
self.display.hide()
|
||||
self.mediaObject.play()
|
||||
self.setVisible(True)
|
||||
|
||||
def stopMedia(self):
|
||||
def onMediaStop(self):
|
||||
self.mediaObject.stop()
|
||||
|
||||
def onMediaPaws(self):
|
||||
self.mediaObject.stop()
|
||||
|
||||
def onMediaFinish(self):
|
||||
self.setVisible(False)
|
||||
self.mediaObject.stop()
|
||||
self.video.close()
|
||||
self.display = QtGui.QLabel(self)
|
||||
self.display.setScaledContents(True)
|
||||
self.layout.insertWidget(0, self.display)
|
||||
|
||||
def mediaFinished(self):
|
||||
pass
|
||||
self.display.show()
|
||||
|
@ -80,6 +80,11 @@ class SlideController(QtGui.QWidget):
|
||||
u'Loop Separator',
|
||||
u'Image SpinBox'
|
||||
]
|
||||
self.media_list = [
|
||||
u'Media Start',
|
||||
u'Media Stop',
|
||||
u'Media Pause'
|
||||
]
|
||||
self.song_list = [
|
||||
u'Edit Song',
|
||||
]
|
||||
@ -172,6 +177,16 @@ class SlideController(QtGui.QWidget):
|
||||
u'Image SpinBox', self.DelaySpinBox)
|
||||
self.DelaySpinBox.setSuffix(self.trUtf8(u's'))
|
||||
self.DelaySpinBox.setToolTip(self.trUtf8(u'Delay between slides in seconds'))
|
||||
self.Toolbar.addToolbarButton(
|
||||
u'Media Start', u':/slides/media_playback_start.png',
|
||||
self.trUtf8(u'Start playing media'), self.onMediaPlay)
|
||||
self.Toolbar.addToolbarButton(
|
||||
u'Media Pause', u':/slides/media_playback_pause.png',
|
||||
self.trUtf8(u'Start playing media'), self.onMediaPause)
|
||||
self.Toolbar.addToolbarButton(
|
||||
u'Media Stop', u':/slides/media_playback_stop.png',
|
||||
self.trUtf8(u'Start playing media'), self.onMediaStop)
|
||||
|
||||
self.ControllerLayout.addWidget(self.Toolbar)
|
||||
# Build the Song Toolbar
|
||||
if isLive:
|
||||
@ -232,6 +247,7 @@ class SlideController(QtGui.QWidget):
|
||||
Receiver().send_message(u'request_spin_delay')
|
||||
if isLive:
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
self.Toolbar.makeWidgetsInvisible(self.media_list)
|
||||
else:
|
||||
self.Toolbar.makeWidgetsInvisible(self.song_list)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -279,6 +295,7 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
self.Songbar.setVisible(False)
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
self.Toolbar.makeWidgetsInvisible(self.media_list)
|
||||
if item.service_item_type == ServiceItemType.Text:
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
if item.name == u'Songs' and \
|
||||
@ -298,6 +315,9 @@ class SlideController(QtGui.QWidget):
|
||||
#Not sensible to allow loops with 1 frame
|
||||
if len(item.frames) > 1:
|
||||
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||
elif item.service_item_type == ServiceItemType.Command and \
|
||||
item.name == u'Media':
|
||||
self.Toolbar.makeWidgetsVisible(self.media_list)
|
||||
|
||||
def enablePreviewToolBar(self, item):
|
||||
"""
|
||||
@ -551,3 +571,12 @@ class SlideController(QtGui.QWidget):
|
||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||
self.parent.LiveController.addServiceManagerItem(
|
||||
self.commandItem, row)
|
||||
|
||||
def onMediaPause(self):
|
||||
Receiver().send_message(u'%s_pause'% self.commandItem.name.lower())
|
||||
|
||||
def onMediaPlay(self):
|
||||
Receiver().send_message(u'%s_play'% self.commandItem.name.lower())
|
||||
|
||||
def onMediaStop(self):
|
||||
Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
|
||||
|
@ -27,6 +27,9 @@
|
||||
<file>slide_last.png</file>
|
||||
<file>slide_next.png</file>
|
||||
<file>slide_previous.png</file>
|
||||
<file>media_playback_start.png</file>
|
||||
<file>media_playback_stop.png</file>
|
||||
<file>media_playback_pause.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="icon" >
|
||||
<file>openlp-logo-16x16.png</file>
|
||||
|
Loading…
Reference in New Issue
Block a user