diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 715228e21..ae6d400fe 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -41,6 +41,23 @@ HTMLIMAGE = """ """ +#http://www.steveheffernan.com/html5-video-player/demo-video-player.html +HTMLVIDEO = u""" + + \" + + + """ + 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 diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 6cd7b175b..938dc1297 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -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())