openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00842
[Merge] lp:~trb143/openlp/fixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
--
https://code.launchpad.net/~trb143/openlp/fixes/+merge/14662
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2009-11-05 23:21:23 +0000
+++ openlp/core/ui/maindisplay.py 2009-11-09 20:35:23 +0000
@@ -107,7 +107,6 @@
self.blankFrame = None
self.frame = None
self.alertactive = False
- self.alertTab = None
self.timer_id = 0
self.firstTime = True
self.mediaLoaded = False
@@ -130,7 +129,6 @@
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'media_stop'), self.onMediaStop)
-
def setup(self, screenNumber):
"""
Sets up the screen on a particular screen.
@@ -264,18 +262,19 @@
self.firstTime = False
else:
self.mediaObject.enqueue(Phonon.MediaSource(file))
- self.onMediaPlay()
+ self.onMediaPlay(message[3])
- def onMediaPlay(self):
- log.debug(u'Play the new media')
- if not self.mediaLoaded and not self.displayBlank:
+ def onMediaPlay(self, live=True):
+ log.debug(u'Play the new media, Live %s', live)
+ if not self.mediaLoaded and not self.displayBlank and live:
self.blankDisplay()
self.firstTime = True
self.mediaLoaded = True
- self.display.hide()
- self.video.setFullScreen(True)
+ if live:
+ self.display.hide()
+ self.video.setFullScreen(True)
self.mediaObject.play()
- if self.primary:
+ if self.primary and live:
self.setVisible(True)
def onMediaPaws(self):
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-11-08 17:40:43 +0000
+++ openlp/core/ui/mainwindow.py 2009-11-09 20:35:23 +0000
@@ -536,6 +536,9 @@
self.settingsForm.postSetUp()
def versionCheck(self):
+ """
+ Checks the version of the Application called from openlp.pyw
+ """
applicationVersion = self.applicationVersion[u'Full']
version = check_latest_version(self.generalConfig, applicationVersion)
if applicationVersion != version:
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-11-08 17:40:43 +0000
+++ openlp/core/ui/slidecontroller.py 2009-11-09 20:35:23 +0000
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
@@ -24,8 +23,11 @@
import logging
import time
+import os
from PyQt4 import QtCore, QtGui
+from PyQt4.phonon import Phonon
+
from openlp.core.lib import OpenLPToolbar, Receiver, ServiceItemType, \
str_to_bool, PluginConfig
@@ -80,20 +82,9 @@
u'Loop Separator',
u'Image SpinBox'
]
- self.media_list = [
- u'Media Start',
- u'Media Stop',
- u'Media Pause'
- ]
self.song_edit_list = [
u'Edit Song',
]
- self.song_list = [
- u'First Slide',
- u'Previous Slide',
- u'Next Slide',
- u'Last Slide',
- ]
self.timer_id = 0
self.commandItem = None
self.songEdit = False
@@ -109,10 +100,12 @@
self.TypeLabel.setText(u'<strong>%s</strong>' %
self.trUtf8(u'Live'))
self.split = 1
+ prefix = u'live_slidecontroller'
else:
self.TypeLabel.setText(u'<strong>%s</strong>' %
self.trUtf8(u'Preview'))
self.split = 0
+ prefix = u'preview_slidecontroller'
self.TypeLabel.setAlignment(QtCore.Qt.AlignCenter)
self.PanelLayout.addWidget(self.TypeLabel)
# Splitter
@@ -190,16 +183,24 @@
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 a Media ToolBar
+ self.Mediabar = OpenLPToolbar(self)
+ self.Mediabar.addToolbarButton(
+ u'Media Start', u':/slides/media_playback_start.png',
+ self.trUtf8(u'Start playing media'), self.onMediaPlay)
+ self.Mediabar.addToolbarButton(
+ u'Media Pause', u':/slides/media_playback_pause.png',
+ self.trUtf8(u'Start playing media'), self.onMediaPause)
+ self.Mediabar.addToolbarButton(
+ u'Media Stop', u':/slides/media_playback_stop.png',
+ self.trUtf8(u'Start playing media'), self.onMediaStop)
+ self.volumeSlider = Phonon.VolumeSlider()
+ self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
+ self.volumeSlider.setObjectName("volumeSlider")
+ self.Mediabar.addToolbarWidget(
+ u'Audio Volume', self.volumeSlider)
+ self.ControllerLayout.addWidget(self.Mediabar)
# Build the Song Toolbar
if isLive:
self.Songbar = OpenLPToolbar(self)
@@ -229,8 +230,21 @@
self.grid = QtGui.QGridLayout(self.PreviewFrame)
self.grid.setMargin(8)
self.grid.setObjectName(u'grid')
+
+ self.SlideLayout = QtGui.QVBoxLayout()
+ self.SlideLayout.setSpacing(0)
+ self.SlideLayout.setMargin(0)
+ self.SlideLayout.setObjectName(u'SlideLayout')
+ self.mediaObject = Phonon.MediaObject(self)
+ self.video = Phonon.VideoWidget()
+ self.video.setVisible(False)
+ self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
+ Phonon.createPath(self.mediaObject, self.video)
+ Phonon.createPath(self.mediaObject, self.audio)
+ self.SlideLayout.insertWidget(0, self.video)
+
# Actual preview screen
- self.SlidePreview = QtGui.QLabel(self.parent)
+ self.SlidePreview = QtGui.QLabel(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -245,7 +259,11 @@
self.SlidePreview.setLineWidth(1)
self.SlidePreview.setScaledContents(True)
self.SlidePreview.setObjectName(u'SlidePreview')
- self.grid.addWidget(self.SlidePreview, 0, 0, 1, 1)
+ self.SlideLayout.insertWidget(0, self.SlidePreview)
+
+
+
+ self.grid.addLayout(self.SlideLayout, 0, 0, 1, 1)
# Signals
QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
@@ -259,13 +277,9 @@
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_edit_list)
- if isLive:
- prefix = u'live_slidecontroller'
- else:
- prefix = u'preview_slidecontroller'
+ self.Mediabar.setVisible(False)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_first' % prefix), self.onSlideSelectedFirst)
QtCore.QObject.connect(Receiver.get_receiver(),
@@ -291,10 +305,9 @@
self.PreviewListWidget.setColumnWidth(0, width)
for framenumber, frame in enumerate(self.commandItem.frames):
if frame[u'text']:
- break
+ return
self.PreviewListWidget.setRowHeight(framenumber, height)
-
def trackSplitter(self, tab, pos):
"""
Splitter between the slide list and the preview panel
@@ -333,10 +346,10 @@
"""
Allows the live toolbar to be customised
"""
+ self.Toolbar.setVisible(True)
self.Songbar.setVisible(False)
+ self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible(self.image_list)
- self.Toolbar.makeWidgetsInvisible(self.media_list)
- self.Toolbar.makeWidgetsVisible(self.song_list)
if item.service_item_type == ServiceItemType.Text:
self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.name == u'Songs' and \
@@ -360,17 +373,24 @@
self.Toolbar.makeWidgetsVisible(self.image_list)
elif item.service_item_type == ServiceItemType.Command and \
item.name == u'Media':
- self.Toolbar.makeWidgetsInvisible(self.song_list)
- self.Toolbar.makeWidgetsVisible(self.media_list)
+ self.Toolbar.setVisible(False)
+ self.Mediabar.setVisible(True)
+ self.volumeSlider.setAudioOutput(self.parent.mainDisplay.audio)
def enablePreviewToolBar(self, item):
"""
Allows the Preview toolbar to be customised
"""
+ self.Toolbar.setVisible(True)
+ self.Mediabar.setVisible(False)
+ self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
if (item.name == u'Songs' or item.name == u'Custom') and item.fromPlugin:
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
- else:
- self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
+ elif item.service_item_type == ServiceItemType.Command and \
+ item.name == u'Media':
+ self.Toolbar.setVisible(False)
+ self.Mediabar.setVisible(True)
+ self.volumeSlider.setAudioOutput(self.audio)
def addServiceItem(self, item):
"""
@@ -382,16 +402,20 @@
#If old item was a command tell it to stop
if self.commandItem and \
self.commandItem.service_item_type == ServiceItemType.Command:
- Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
+ self.onMediaStop()
self.commandItem = item
before = time.time()
item.render()
log.info(u'Rendering took %4s' % (time.time() - before))
self.enableToolBar(item)
if item.service_item_type == ServiceItemType.Command:
- Receiver().send_message(u'%s_start' % item.name.lower(), \
- [item.shortname, item.service_item_path,
- item.service_frames[0][u'title'], self.isLive])
+ if self.isLive:
+ Receiver().send_message(u'%s_start' % item.name.lower(), \
+ [item.shortname, item.service_item_path,
+ item.service_frames[0][u'title'], self.isLive])
+ else:
+ if item.name == u'Media':
+ self.onMediaStart(item)
slideno = 0
if self.songEdit:
slideno = self.row
@@ -415,13 +439,17 @@
#If old item was a command tell it to stop
if self.commandItem and \
self.commandItem.service_item_type == ServiceItemType.Command:
- Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
+ self.onMediaStop()
self.commandItem = item
self.enableToolBar(item)
if item.service_item_type == ServiceItemType.Command:
- Receiver().send_message(u'%s_start' % item.name.lower(), \
- [item.shortname, item.service_item_path,
- item.service_frames[0][u'title'], slideno, self.isLive])
+ if self.isLive:
+ Receiver().send_message(u'%s_start' % item.name.lower(), \
+ [item.shortname, item.service_item_path,
+ item.service_frames[0][u'title'], slideno, self.isLive])
+ else:
+ if item.name == u'Media':
+ self.onMediaStart(item)
self.displayServiceManagerItems(item, slideno)
def displayServiceManagerItems(self, serviceitem, slideno):
@@ -623,11 +651,31 @@
self.parent.LiveController.addServiceManagerItem(
self.commandItem, row)
+ def onMediaStart(self, item):
+ self.mediaObject.stop()
+ self.mediaObject.clearQueue()
+ file = os.path.join(item.service_item_path, item.service_frames[0][u'title'])
+ self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
+ self.onMediaPlay()
+
def onMediaPause(self):
- Receiver().send_message(u'%s_pause'% self.commandItem.name.lower())
+ if self.isLive:
+ Receiver().send_message(u'%s_pause'% self.commandItem.name.lower())
+ else:
+ self.mediaObject.pause()
def onMediaPlay(self):
- Receiver().send_message(u'%s_play'% self.commandItem.name.lower())
+ if self.isLive:
+ Receiver().send_message(u'%s_play'% self.commandItem.name.lower(), self.isLive)
+ else:
+ self.SlidePreview.hide()
+ self.video.show()
+ self.mediaObject.play()
def onMediaStop(self):
- Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
+ if self.isLive:
+ Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
+ else:
+ self.mediaObject.stop()
+ self.video.hide()
+ self.SlidePreview.show()
Follow ups