forked from openlp/openlp
Video and Image updates
This commit is contained in:
parent
6cd1e520a1
commit
8b5931d50c
@ -41,6 +41,23 @@ HTMLIMAGE = """<html>
|
||||
</body></html>
|
||||
"""
|
||||
|
||||
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
|
||||
HTMLVIDEO = u"""<html>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var video;
|
||||
var bodyLoaded = function(){
|
||||
video = document.getElementById("video");
|
||||
video.volume = 0;
|
||||
}
|
||||
</script>
|
||||
<body id=\"body\" onload=\"bodyLoaded();>\"
|
||||
<video id=\"video\" src=\"%s\"
|
||||
autoplay loop width=%s height=%s autobuffer=\"autobuffer\" preload >
|
||||
your browser does not support the video tag
|
||||
</video>
|
||||
</body></html>
|
||||
"""
|
||||
|
||||
class DisplayManager(QtGui.QWidget):
|
||||
"""
|
||||
Wrapper class to hold the display widgets.
|
||||
@ -93,6 +110,12 @@ class DisplayManager(QtGui.QWidget):
|
||||
"""
|
||||
self.mainDisplay.displayImage(path)
|
||||
|
||||
def displayVideo(self, path):
|
||||
"""
|
||||
Handles the addition of a background Video to the displays
|
||||
"""
|
||||
self.mainDisplay.displayVideo(path)
|
||||
|
||||
def onStartVideo(self, item):
|
||||
"""
|
||||
Handles the Starting of a Video and Display Management
|
||||
@ -364,6 +387,16 @@ class MainDisplay(DisplayWidget):
|
||||
log.debug(u'adddisplayImage')
|
||||
self.imageDisplay.setHtml(HTMLIMAGE % path)
|
||||
|
||||
def displayVideo(self, path):
|
||||
"""
|
||||
Places the Video passed on the display screen
|
||||
``path``
|
||||
The path to the image to be displayed
|
||||
"""
|
||||
log.debug(u'adddisplayVideo')
|
||||
self.imageDisplay.setHtml(HTMLVIDEO %
|
||||
(path, self.screen[u'size'].width(), self.screen[u'size'].height()))
|
||||
|
||||
def frameView(self, frame, transition=False):
|
||||
"""
|
||||
Called from a slide controller to display a frame
|
||||
|
@ -29,7 +29,8 @@ import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||
ItemCapabilities, SettingsManager, translate, check_item_selected
|
||||
ItemCapabilities, SettingsManager, translate, check_item_selected, \
|
||||
context_menu_action
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -73,13 +74,13 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.hasNewIcon = False
|
||||
self.hasEditIcon = False
|
||||
|
||||
# def addListViewToToolBar(self):
|
||||
# MediaManagerItem.addListViewToToolBar(self)
|
||||
# self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
# self.ListView.addAction(
|
||||
# context_menu_action(self.ListView, u':/slides/slide_blank.png',
|
||||
# translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
# self.onReplaceClick))
|
||||
def addListViewToToolBar(self):
|
||||
MediaManagerItem.addListViewToToolBar(self)
|
||||
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.ListView.addAction(
|
||||
context_menu_action(self.ListView, u':/slides/slide_blank.png',
|
||||
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick))
|
||||
|
||||
def addEndHeaderBar(self):
|
||||
self.ImageWidget = QtGui.QWidget(self)
|
||||
@ -92,24 +93,31 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.ImageWidget.setSizePolicy(sizePolicy)
|
||||
self.ImageWidget.setObjectName(u'ImageWidget')
|
||||
#Replace backgrounds do not work at present so remove functionality.
|
||||
# self.blankButton = self.Toolbar.addToolbarButton(
|
||||
# u'Replace Background', u':/slides/slide_blank.png',
|
||||
# translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
# self.onReplaceClick, False)
|
||||
self.blankButton = self.Toolbar.addToolbarButton(
|
||||
u'Replace Background', u':/slides/slide_blank.png',
|
||||
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||
self.onReplaceClick, False)
|
||||
# Add the song widget to the page layout
|
||||
self.PageLayout.addWidget(self.ImageWidget)
|
||||
|
||||
# def onReplaceClick(self):
|
||||
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,
|
||||
# translate('MediaPlugin.MediaItem', 'No item selected'),
|
||||
# translate('MediaPlugin.MediaItem',
|
||||
# 'You must select one item'))
|
||||
if not self.ListView.selectedIndexes():
|
||||
QtGui.QMessageBox.information(self,
|
||||
translate('MediaPlugin.MediaItem', 'No item selected'),
|
||||
translate('MediaPlugin.MediaItem',
|
||||
'You must select one item'))
|
||||
return
|
||||
item = self.ListView.currentItem()
|
||||
if item is None:
|
||||
return False
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
print filename
|
||||
self.parent.live_controller.displayManager.displayVideo(filename)
|
||||
# items = self.ListView.selectedIndexes()
|
||||
# for item in items:
|
||||
# bitem = self.ListView.item(item.row())
|
||||
|
Loading…
Reference in New Issue
Block a user