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>
|
</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):
|
class DisplayManager(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
Wrapper class to hold the display widgets.
|
Wrapper class to hold the display widgets.
|
||||||
@ -93,6 +110,12 @@ class DisplayManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
self.mainDisplay.displayImage(path)
|
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):
|
def onStartVideo(self, item):
|
||||||
"""
|
"""
|
||||||
Handles the Starting of a Video and Display Management
|
Handles the Starting of a Video and Display Management
|
||||||
@ -364,6 +387,16 @@ class MainDisplay(DisplayWidget):
|
|||||||
log.debug(u'adddisplayImage')
|
log.debug(u'adddisplayImage')
|
||||||
self.imageDisplay.setHtml(HTMLIMAGE % path)
|
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):
|
def frameView(self, frame, transition=False):
|
||||||
"""
|
"""
|
||||||
Called from a slide controller to display a frame
|
Called from a slide controller to display a frame
|
||||||
|
@ -29,7 +29,8 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
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__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -73,13 +74,13 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.hasNewIcon = False
|
self.hasNewIcon = False
|
||||||
self.hasEditIcon = False
|
self.hasEditIcon = False
|
||||||
|
|
||||||
# def addListViewToToolBar(self):
|
def addListViewToToolBar(self):
|
||||||
# MediaManagerItem.addListViewToToolBar(self)
|
MediaManagerItem.addListViewToToolBar(self)
|
||||||
# self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
# self.ListView.addAction(
|
self.ListView.addAction(
|
||||||
# context_menu_action(self.ListView, u':/slides/slide_blank.png',
|
context_menu_action(self.ListView, u':/slides/slide_blank.png',
|
||||||
# translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||||
# self.onReplaceClick))
|
self.onReplaceClick))
|
||||||
|
|
||||||
def addEndHeaderBar(self):
|
def addEndHeaderBar(self):
|
||||||
self.ImageWidget = QtGui.QWidget(self)
|
self.ImageWidget = QtGui.QWidget(self)
|
||||||
@ -92,24 +93,31 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.ImageWidget.setSizePolicy(sizePolicy)
|
self.ImageWidget.setSizePolicy(sizePolicy)
|
||||||
self.ImageWidget.setObjectName(u'ImageWidget')
|
self.ImageWidget.setObjectName(u'ImageWidget')
|
||||||
#Replace backgrounds do not work at present so remove functionality.
|
#Replace backgrounds do not work at present so remove functionality.
|
||||||
# self.blankButton = self.Toolbar.addToolbarButton(
|
self.blankButton = self.Toolbar.addToolbarButton(
|
||||||
# u'Replace Background', u':/slides/slide_blank.png',
|
u'Replace Background', u':/slides/slide_blank.png',
|
||||||
# translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
|
||||||
# self.onReplaceClick, False)
|
self.onReplaceClick, False)
|
||||||
# Add the song widget to the page layout
|
# Add the song widget to the page layout
|
||||||
self.PageLayout.addWidget(self.ImageWidget)
|
self.PageLayout.addWidget(self.ImageWidget)
|
||||||
|
|
||||||
# def onReplaceClick(self):
|
def onReplaceClick(self):
|
||||||
# if self.background:
|
# if self.background:
|
||||||
# self.background = False
|
# self.background = False
|
||||||
# Receiver.send_message(u'videodisplay_stop')
|
# Receiver.send_message(u'videodisplay_stop')
|
||||||
# else:
|
# else:
|
||||||
# self.background = True
|
# self.background = True
|
||||||
# if not self.ListView.selectedIndexes():
|
if not self.ListView.selectedIndexes():
|
||||||
# QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self,
|
||||||
# translate('MediaPlugin.MediaItem', 'No item selected'),
|
translate('MediaPlugin.MediaItem', 'No item selected'),
|
||||||
# translate('MediaPlugin.MediaItem',
|
translate('MediaPlugin.MediaItem',
|
||||||
# 'You must select one item'))
|
'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()
|
# items = self.ListView.selectedIndexes()
|
||||||
# for item in items:
|
# for item in items:
|
||||||
# bitem = self.ListView.item(item.row())
|
# bitem = self.ListView.item(item.row())
|
||||||
|
Loading…
Reference in New Issue
Block a user