Text over video arrives to OpenLP

bzr-revno: 804
This commit is contained in:
Tim Bentley 2010-04-30 18:31:19 +01:00
commit 7daf1e332d
5 changed files with 84 additions and 153 deletions

View File

@ -137,6 +137,8 @@ class MainDisplay(DisplayWidget):
QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'videodisplay_background'), self.hideDisplayForVideo)
def setup(self):
"""
@ -332,6 +334,7 @@ class VideoDisplay(Phonon.VideoWidget):
self.parent = parent
self.screens = screens
self.hidden = False
self.background = False
self.mediaObject = Phonon.MediaObject()
self.setAspectRatio(aspect)
self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory)
@ -351,8 +354,12 @@ class VideoDisplay(Phonon.VideoWidget):
QtCore.SIGNAL(u'videodisplay_pause'), self.onMediaPause)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'videodisplay_stop'), self.onMediaStop)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'videodisplay_background'), self.onMediaBackground)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.setup)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'finished()'), self.onMediaBackground)
self.setVisible(False)
def keyPressEvent(self, event):
@ -382,6 +389,15 @@ class VideoDisplay(Phonon.VideoWidget):
self.setVisible(False)
self.primary = True
def onMediaBackground(self, message):
if not message:
message = self.message
log.debug(u'VideoDisplay Queue new media message %s' % message)
source = self.mediaObject.setCurrentSource(Phonon.MediaSource(message))
self.message = message
self.background = True
self._play()
def onMediaQueue(self, message):
log.debug(u'VideoDisplay Queue new media message %s' % message)
file = os.path.join(message[0].get_frame_path(),
@ -407,6 +423,8 @@ class VideoDisplay(Phonon.VideoWidget):
def onMediaStop(self):
log.debug(u'VideoDisplay Media stopped by user')
self.background = False
self.message = None
self.mediaObject.stop()
self.onMediaFinish()

View File

@ -589,10 +589,10 @@ class SlideController(QtGui.QWidget):
QtCore.QVariant(checked))
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
Receiver.send_message(u'presentation_blank')
self.blankPlugin(True)
else:
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'presentation_unblank')
self.blankPlugin(False)
def onThemeDisplay(self, checked):
"""
@ -603,8 +603,10 @@ class SlideController(QtGui.QWidget):
self.hideButton.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
self.blankPlugin(True)
else:
Receiver.send_message(u'maindisplay_show')
self.blankPlugin(False)
def onHideDisplay(self, checked):
"""
@ -615,8 +617,25 @@ class SlideController(QtGui.QWidget):
self.themeButton.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.blankPlugin(True)
else:
Receiver.send_message(u'maindisplay_show')
self.blankPlugin(False)
def blankPlugin(self, blank):
"""
Blank the display screen.
"""
if self.serviceItem is not None:
if blank:
Receiver.send_message(u'%s_blank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
def onSlideSelected(self):
"""

View File

@ -29,7 +29,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager
ItemCapabilities, SettingsManager, contextMenuAction, Receiver
log = logging.getLogger(__name__)
@ -47,6 +47,7 @@ class MediaMediaItem(MediaManagerItem):
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Media'
self.IconPath = u'images/image'
self.background = False
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = MediaListView
@ -71,6 +72,48 @@ class MediaMediaItem(MediaManagerItem):
self.hasNewIcon = False
self.hasEditIcon = False
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.ListView.addAction(
contextMenuAction(
self.ListView, u':/slides/slide_blank.png',
self.trUtf8('Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.Toolbar.addToolbarButton(
u'Replace Background', u':/slides/slide_blank.png',
self.trUtf8('Replace Live Background'), self.onReplaceClick, False)
# Add the song widget to the page layout
self.PageLayout.addWidget(self.ImageWidget)
def onReplaceClick(self):
if self.background:
self.background = False
Receiver.send_message(u'videodisplay_stop')
else:
self.background = True
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
self.trUtf8('No item selected'),
self.trUtf8('You must select one item'))
items = self.ListView.selectedIndexes()
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
Receiver.send_message(u'videodisplay_background', filename)
def generateSlideData(self, service_item, item=None):
if item is None:
item = self.ListView.currentItem()

View File

@ -108,6 +108,7 @@ class PresentationMediaItem(MediaManagerItem):
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.settings_section),
u'thumbnails')
self.ListView.setIconSize(QtCore.QSize(88,50))
if not os.path.exists(self.servicePath):
os.mkdir(self.servicePath)
list = SettingsManager.load_list(

View File

@ -1,150 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'displaytab.ui'
#
# Created: Tue Apr 27 06:10:08 2010
# by: PyQt4 UI code generator 4.7.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_DisplaysDialog(object):
def setupUi(self, DisplaysDialog):
DisplaysDialog.setObjectName("DisplaysDialog")
DisplaysDialog.resize(620, 716)
self.layoutWidget = QtGui.QWidget(DisplaysDialog)
self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79))
self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout.setObjectName("verticalLayout")
self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget)
self.CurrentGroupBox.setObjectName("CurrentGroupBox")
self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox)
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout_6 = QtGui.QVBoxLayout()
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.XLabel = QtGui.QLabel(self.CurrentGroupBox)
self.XLabel.setAlignment(QtCore.Qt.AlignCenter)
self.XLabel.setObjectName("XLabel")
self.verticalLayout_6.addWidget(self.XLabel)
self.Xpos = QtGui.QLabel(self.CurrentGroupBox)
self.Xpos.setAlignment(QtCore.Qt.AlignCenter)
self.Xpos.setObjectName("Xpos")
self.verticalLayout_6.addWidget(self.Xpos)
self.horizontalLayout.addLayout(self.verticalLayout_6)
self.verticalLayout_7 = QtGui.QVBoxLayout()
self.verticalLayout_7.setObjectName("verticalLayout_7")
self.YLabel = QtGui.QLabel(self.CurrentGroupBox)
self.YLabel.setAlignment(QtCore.Qt.AlignCenter)
self.YLabel.setObjectName("YLabel")
self.verticalLayout_7.addWidget(self.YLabel)
self.Ypos = QtGui.QLabel(self.CurrentGroupBox)
self.Ypos.setAlignment(QtCore.Qt.AlignCenter)
self.Ypos.setObjectName("Ypos")
self.verticalLayout_7.addWidget(self.Ypos)
self.horizontalLayout.addLayout(self.verticalLayout_7)
self.verticalLayout_9 = QtGui.QVBoxLayout()
self.verticalLayout_9.setObjectName("verticalLayout_9")
self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox)
self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.HeightLabel.setObjectName("HeightLabel")
self.verticalLayout_9.addWidget(self.HeightLabel)
self.Height = QtGui.QLabel(self.CurrentGroupBox)
self.Height.setAlignment(QtCore.Qt.AlignCenter)
self.Height.setObjectName("Height")
self.verticalLayout_9.addWidget(self.Height)
self.horizontalLayout.addLayout(self.verticalLayout_9)
self.verticalLayout_8 = QtGui.QVBoxLayout()
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox)
self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.WidthLabel.setObjectName("WidthLabel")
self.verticalLayout_8.addWidget(self.WidthLabel)
self.Width = QtGui.QLabel(self.CurrentGroupBox)
self.Width.setAlignment(QtCore.Qt.AlignCenter)
self.Width.setObjectName("Width")
self.verticalLayout_8.addWidget(self.Width)
self.horizontalLayout.addLayout(self.verticalLayout_8)
self.verticalLayout.addWidget(self.CurrentGroupBox)
self.CurrentGroupBox_2 = QtGui.QGroupBox(DisplaysDialog)
self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87))
self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215))
self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2")
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.XAmendLabel.setObjectName("XAmendLabel")
self.verticalLayout_2.addWidget(self.XAmendLabel)
self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.XposEdit.setMaxLength(4)
self.XposEdit.setObjectName("XposEdit")
self.verticalLayout_2.addWidget(self.XposEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
self.verticalLayout_3 = QtGui.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.YAmendLabel.setObjectName("YAmendLabel")
self.verticalLayout_3.addWidget(self.YAmendLabel)
self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.YposEdit.setMaxLength(4)
self.YposEdit.setObjectName("YposEdit")
self.verticalLayout_3.addWidget(self.YposEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_3)
self.verticalLayout_4 = QtGui.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.HeightAmendLabel.setObjectName("HeightAmendLabel")
self.verticalLayout_4.addWidget(self.HeightAmendLabel)
self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.HeightEdit.setMaxLength(4)
self.HeightEdit.setObjectName("HeightEdit")
self.verticalLayout_4.addWidget(self.HeightEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_4)
self.verticalLayout_5 = QtGui.QVBoxLayout()
self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.WidthAmendLabel.setObjectName("WidthAmendLabel")
self.verticalLayout_5.addWidget(self.WidthAmendLabel)
self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215))
self.WidthEdit.setObjectName("WidthEdit")
self.verticalLayout_5.addWidget(self.WidthEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_5)
self.OverrideCheckBox = QtGui.QCheckBox(DisplaysDialog)
self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23))
self.OverrideCheckBox.setObjectName("OverrideCheckBox")
self.retranslateUi(DisplaysDialog)
QtCore.QMetaObject.connectSlotsByName(DisplaysDialog)
def retranslateUi(self, DisplaysDialog):
DisplaysDialog.setWindowTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8))
self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Default Settings", None, QtGui.QApplication.UnicodeUTF8))
self.XLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "X", None, QtGui.QApplication.UnicodeUTF8))
self.Xpos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8))
self.YLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Y", None, QtGui.QApplication.UnicodeUTF8))
self.Ypos.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8))
self.HeightLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Height", None, QtGui.QApplication.UnicodeUTF8))
self.Height.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8))
self.WidthLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Width", None, QtGui.QApplication.UnicodeUTF8))
self.Width.setText(QtGui.QApplication.translate("DisplaysDialog", "0", None, QtGui.QApplication.UnicodeUTF8))
self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("DisplaysDialog", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8))
self.XAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "X", None, QtGui.QApplication.UnicodeUTF8))
self.YAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Y", None, QtGui.QApplication.UnicodeUTF8))
self.HeightAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Height", None, QtGui.QApplication.UnicodeUTF8))
self.WidthAmendLabel.setText(QtGui.QApplication.translate("DisplaysDialog", "Width", None, QtGui.QApplication.UnicodeUTF8))
self.OverrideCheckBox.setText(QtGui.QApplication.translate("DisplaysDialog", "Override Output Display", None, QtGui.QApplication.UnicodeUTF8))