forked from openlp/openlp
bugfixing
This commit is contained in:
parent
ac7126d929
commit
592af0e181
@ -66,6 +66,7 @@ body {
|
|||||||
#image {
|
#image {
|
||||||
z-index:2;
|
z-index:2;
|
||||||
}
|
}
|
||||||
|
%s
|
||||||
#video1 {
|
#video1 {
|
||||||
z-index:3;
|
z-index:3;
|
||||||
}
|
}
|
||||||
@ -98,97 +99,8 @@ sup {
|
|||||||
</style>
|
</style>
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
var timer = null;
|
var timer = null;
|
||||||
var video_timer = null;
|
|
||||||
var current_video = '1';
|
|
||||||
var transition = %s;
|
var transition = %s;
|
||||||
|
%s
|
||||||
function show_video(state, path, volume, loop, seekVal){
|
|
||||||
// Note, the preferred method for looping would be to use the
|
|
||||||
// video tag loop attribute.
|
|
||||||
// But QtWebKit doesn't support this. Neither does it support the
|
|
||||||
// onended event, hence the setInterval()
|
|
||||||
// In addition, setting the currentTime attribute to zero to restart
|
|
||||||
// the video raises an INDEX_SIZE_ERROR: DOM Exception 1
|
|
||||||
// To complicate it further, sometimes vid.currentTime stops
|
|
||||||
// slightly short of vid.duration and vid.ended is intermittent!
|
|
||||||
//
|
|
||||||
// Note, currently the background may go black between loops. Not
|
|
||||||
// desirable. Need to investigate using two <video>'s, and hiding/
|
|
||||||
// preloading one, and toggle between the two when looping.
|
|
||||||
|
|
||||||
if(current_video=='1'){
|
|
||||||
var vid = document.getElementById('video1');
|
|
||||||
var vid2 = document.getElementById('video2');
|
|
||||||
} else {
|
|
||||||
var vid = document.getElementById('video2');
|
|
||||||
var vid2 = document.getElementById('video1');
|
|
||||||
}
|
|
||||||
if(volume != null){
|
|
||||||
vid.volume = volume;
|
|
||||||
vid2.volume = volume;
|
|
||||||
}
|
|
||||||
switch(state){
|
|
||||||
case 'init':
|
|
||||||
vid.src = path;
|
|
||||||
vid2.src = path;
|
|
||||||
if(loop == null) loop = false;
|
|
||||||
vid.looping = loop;
|
|
||||||
vid2.looping = loop;
|
|
||||||
vid.load();
|
|
||||||
break;
|
|
||||||
case 'load':
|
|
||||||
vid2.style.visibility = 'hidden';
|
|
||||||
vid2.load();
|
|
||||||
break;
|
|
||||||
case 'play':
|
|
||||||
vid.play();
|
|
||||||
vid.style.visibility = 'visible';
|
|
||||||
if(vid.looping){
|
|
||||||
video_timer = setInterval(
|
|
||||||
function() {
|
|
||||||
show_video('poll');
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'pause':
|
|
||||||
if(video_timer!=null){
|
|
||||||
clearInterval(video_timer);
|
|
||||||
video_timer = null;
|
|
||||||
}
|
|
||||||
vid.pause();
|
|
||||||
break;
|
|
||||||
case 'stop':
|
|
||||||
show_video('pause');
|
|
||||||
vid.style.visibility = 'hidden';
|
|
||||||
break;
|
|
||||||
case 'poll':
|
|
||||||
if(vid.ended||vid.currentTime+0.2>vid.duration)
|
|
||||||
show_video('swap');
|
|
||||||
break;
|
|
||||||
case 'swap':
|
|
||||||
show_video('pause');
|
|
||||||
if(current_video=='1')
|
|
||||||
current_video = '2';
|
|
||||||
else
|
|
||||||
current_video = '1';
|
|
||||||
show_video('play');
|
|
||||||
show_video('load');
|
|
||||||
break;
|
|
||||||
case 'close':
|
|
||||||
show_video('stop');
|
|
||||||
vid.src = '';
|
|
||||||
vid2.src = '';
|
|
||||||
break;
|
|
||||||
case 'length':
|
|
||||||
return vid.duration;
|
|
||||||
case 'currentTime':
|
|
||||||
return vid.currentTime;
|
|
||||||
case 'seek':
|
|
||||||
// doesnt work curently
|
|
||||||
//vid.currentTime = seekVal;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_image(src){
|
function show_image(src){
|
||||||
var img = document.getElementById('image');
|
var img = document.getElementById('image');
|
||||||
@ -316,79 +228,12 @@ sup {
|
|||||||
return (text_opacity()==1);
|
return (text_opacity()==1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFlashMovieObject(movieName)
|
|
||||||
{
|
|
||||||
if (window.document[movieName])
|
|
||||||
{
|
|
||||||
return window.document[movieName];
|
|
||||||
}
|
|
||||||
if (navigator.appName.indexOf("Microsoft Internet")==-1)
|
|
||||||
{
|
|
||||||
if (document.embeds && document.embeds[movieName])
|
|
||||||
return document.embeds[movieName];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html
|
|
||||||
function show_flash(state, path, volume, seekVal){
|
|
||||||
var text = document.getElementById('flash');
|
|
||||||
var flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
|
||||||
var src = "src = 'file:///" + path + "'";
|
|
||||||
var view_parm = " wmode='opaque'" +
|
|
||||||
" width='" + window.innerWidth + "'" +
|
|
||||||
" height='" + window.innerHeight + "'";
|
|
||||||
var swf_parm = " name='OpenLPFlashMovie'" +
|
|
||||||
" autostart='true' loop='false' play='true'" +
|
|
||||||
" hidden='false' swliveconnect='true' allowscriptaccess='always'" +
|
|
||||||
" volume='" + volume + "'";
|
|
||||||
|
|
||||||
switch(state){
|
|
||||||
case 'load':
|
|
||||||
text.innerHTML = "<embed " + src + view_parm + swf_parm + "/>";
|
|
||||||
flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
|
||||||
text.style.visibility = 'visible';
|
|
||||||
flashMovie.Play();
|
|
||||||
break;
|
|
||||||
case 'play':
|
|
||||||
text.style.visibility = 'visible';
|
|
||||||
flashMovie.Play();
|
|
||||||
break;
|
|
||||||
case 'pause':
|
|
||||||
flashMovie.StopPlay();
|
|
||||||
text.style.visibility = 'hidden';
|
|
||||||
break;
|
|
||||||
case 'stop':
|
|
||||||
flashMovie.StopPlay();
|
|
||||||
text.style.visibility = 'hidden';
|
|
||||||
tempHtml = text.innerHTML;
|
|
||||||
text.innerHTML = '';
|
|
||||||
text.innerHTML = tempHtml;
|
|
||||||
break;
|
|
||||||
case 'close':
|
|
||||||
flashMovie.StopPlay();
|
|
||||||
text.style.visibility = 'hidden';
|
|
||||||
text.innerHTML = '';
|
|
||||||
break;
|
|
||||||
case 'length':
|
|
||||||
return flashMovie.TotalFrames();
|
|
||||||
case 'currentTime':
|
|
||||||
return flashMovie.CurrentFrame();
|
|
||||||
case 'seek':
|
|
||||||
// flashMovie.GotoFrame(seekVal);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<img id="bgimage" class="size" %s />
|
<img id="bgimage" class="size" %s />
|
||||||
<img id="image" class="size" %s />
|
<img id="image" class="size" %s />
|
||||||
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
|
%s
|
||||||
</video>
|
|
||||||
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
|
|
||||||
</video>
|
|
||||||
<div id="flash" class="size" style="visibility:hidden"></div>
|
|
||||||
%s
|
%s
|
||||||
<div id="footer" class="footer"></div>
|
<div id="footer" class="footer"></div>
|
||||||
<div id="black" class="size"></div>
|
<div id="black" class="size"></div>
|
||||||
@ -397,7 +242,7 @@ sup {
|
|||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def build_html(item, screen, alert, islive, background, image=None):
|
def build_html(item, screen, alert, islive, background, plugins=None, image=None):
|
||||||
"""
|
"""
|
||||||
Build the full web paged structure for display
|
Build the full web paged structure for display
|
||||||
|
|
||||||
@ -416,6 +261,9 @@ def build_html(item, screen, alert, islive, background, image=None):
|
|||||||
``background``
|
``background``
|
||||||
Theme background image - bytes
|
Theme background image - bytes
|
||||||
|
|
||||||
|
``plugins``
|
||||||
|
access to the plugins
|
||||||
|
|
||||||
``image``
|
``image``
|
||||||
Image media item - bytes
|
Image media item - bytes
|
||||||
"""
|
"""
|
||||||
@ -434,14 +282,25 @@ def build_html(item, screen, alert, islive, background, image=None):
|
|||||||
image_src = u'src="data:image/png;base64,%s"' % image
|
image_src = u'src="data:image/png;base64,%s"' % image
|
||||||
else:
|
else:
|
||||||
image_src = u'style="display:none;"'
|
image_src = u'style="display:none;"'
|
||||||
|
plugin_css = u''
|
||||||
|
plugin_js = u''
|
||||||
|
plugin_html = u''
|
||||||
|
if plugins:
|
||||||
|
for plugin in plugins:
|
||||||
|
plugin_css += plugin.display_css()
|
||||||
|
plugin_js += plugin.display_javascript()
|
||||||
|
plugin_html += plugin.display_html()
|
||||||
html = HTMLSRC % (build_background_css(item, width, height),
|
html = HTMLSRC % (build_background_css(item, width, height),
|
||||||
width, height,
|
width, height,
|
||||||
|
plugin_css,
|
||||||
build_alert_css(alert, width),
|
build_alert_css(alert, width),
|
||||||
build_footer_css(item, height),
|
build_footer_css(item, height),
|
||||||
build_lyrics_css(item, webkitvers),
|
build_lyrics_css(item, webkitvers),
|
||||||
u'true' if theme and theme.display_slide_transition and islive \
|
u'true' if theme and theme.display_slide_transition and islive \
|
||||||
else u'false',
|
else u'false',
|
||||||
|
plugin_js,
|
||||||
bgimage_src, image_src,
|
bgimage_src, image_src,
|
||||||
|
plugin_html,
|
||||||
build_lyrics_html(item, webkitvers))
|
build_lyrics_html(item, webkitvers))
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
@ -374,3 +374,21 @@ class Plugin(QtCore.QObject):
|
|||||||
after this has been set.
|
after this has been set.
|
||||||
"""
|
"""
|
||||||
self.textStrings[name] = {u'title': title, u'tooltip': tooltip}
|
self.textStrings[name] = {u'title': title, u'tooltip': tooltip}
|
||||||
|
|
||||||
|
def display_css(self):
|
||||||
|
"""
|
||||||
|
Add css style sheets to htmlbuilder
|
||||||
|
"""
|
||||||
|
return u''
|
||||||
|
|
||||||
|
def display_javascript(self):
|
||||||
|
"""
|
||||||
|
Add javascript functions to htmlbuilder
|
||||||
|
"""
|
||||||
|
return u''
|
||||||
|
|
||||||
|
def display_html(self):
|
||||||
|
"""
|
||||||
|
Add html code to htmlbuilder
|
||||||
|
"""
|
||||||
|
return u''
|
||||||
|
@ -56,18 +56,22 @@ class Display(QtGui.QGraphicsView):
|
|||||||
"""
|
"""
|
||||||
Set up and build the preview screen
|
Set up and build the preview screen
|
||||||
"""
|
"""
|
||||||
|
# self.setGeometry(0, 0,
|
||||||
|
# self.parent().width(), self.parent().height())
|
||||||
self.webView = QtWebKit.QWebView(self)
|
self.webView = QtWebKit.QWebView(self)
|
||||||
self.webView.setGeometry(0, 0,
|
self.webView.setGeometry(0, 0,
|
||||||
self.parent().width(), self.parent().height())
|
self.parent().width(), self.parent().height())
|
||||||
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
|
self.webView.settings().setAttribute(
|
||||||
|
QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||||
self.page = self.webView.page()
|
self.page = self.webView.page()
|
||||||
self.frame = self.page.mainFrame()
|
self.frame = self.page.mainFrame()
|
||||||
screen = {}
|
screen = {}
|
||||||
screen[u'size'] = self.size()
|
screen[u'size'] = self.size()
|
||||||
serviceItem = ServiceItem()
|
serviceItem = ServiceItem()
|
||||||
self.webView.setHtml(build_html(serviceItem, screen,
|
self.webView.setHtml(build_html(serviceItem, screen,
|
||||||
None, None, None))
|
None, None, None, self.controller.parent().pluginManager.plugins))
|
||||||
self.webView.hide()
|
self.webView.hide()
|
||||||
|
#self.hide()
|
||||||
|
|
||||||
class MainDisplay(QtGui.QGraphicsView):
|
class MainDisplay(QtGui.QGraphicsView):
|
||||||
"""
|
"""
|
||||||
@ -158,7 +162,8 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
serviceItem = ServiceItem()
|
serviceItem = ServiceItem()
|
||||||
serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
|
serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
|
||||||
self.webView.setHtml(build_html(serviceItem, self.screen,
|
self.webView.setHtml(build_html(serviceItem, self.screen,
|
||||||
self.alertTab, self.isLive, None))
|
self.alertTab, self.isLive, None,
|
||||||
|
self.controller.parent().pluginManager.plugins))
|
||||||
self.__hideMouse()
|
self.__hideMouse()
|
||||||
# To display or not to display?
|
# To display or not to display?
|
||||||
if not self.screen[u'primary']:
|
if not self.screen[u'primary']:
|
||||||
@ -350,7 +355,7 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
else:
|
else:
|
||||||
image_bytes = None
|
image_bytes = None
|
||||||
html = build_html(self.serviceItem, self.screen, self.alertTab,
|
html = build_html(self.serviceItem, self.screen, self.alertTab,
|
||||||
self.isLive, background, image_bytes)
|
self.isLive, background, self.controller.parent().pluginManager.plugins, image_bytes)
|
||||||
log.debug(u'buildHtml - pre setHtml')
|
log.debug(u'buildHtml - pre setHtml')
|
||||||
self.webView.setHtml(html)
|
self.webView.setHtml(html)
|
||||||
log.debug(u'buildHtml - post setHtml')
|
log.debug(u'buildHtml - post setHtml')
|
||||||
|
@ -62,7 +62,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.screens = ScreenList.get_instance()
|
self.screens = ScreenList.get_instance()
|
||||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||||
float(self.screens.current[u'size'].height())
|
float(self.screens.current[u'size'].height())
|
||||||
#self.display = None#MainDisplay(self, self, self.screens, isLive)
|
|
||||||
self.image_manager = self.parent().image_manager
|
self.image_manager = self.parent().image_manager
|
||||||
self.loopList = [
|
self.loopList = [
|
||||||
u'Play Slides Menu',
|
u'Play Slides Menu',
|
||||||
@ -334,7 +333,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
def getControlPanel(self):
|
def getControlPanel(self):
|
||||||
return self.controllerLayout
|
return self.controllerLayout
|
||||||
|
|
||||||
def sendToPlugins(self, v1=None, v2=None, v3=None, v4=None, v5=None):
|
def sendToPlugins(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
This is the generic function to send signal for control widgets,
|
This is the generic function to send signal for control widgets,
|
||||||
created from within other plugins
|
created from within other plugins
|
||||||
@ -342,7 +341,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
sender = self.sender().objectName() or self.sender().text()
|
sender = self.sender().objectName() or self.sender().text()
|
||||||
controller = self
|
controller = self
|
||||||
Receiver.send_message('%s' % sender, [controller, v1, v2, v3, v4, v5])
|
Receiver.send_message('%s' % sender, [controller, kwargs])
|
||||||
|
|
||||||
def setPreviewHotkeys(self, parent=None):
|
def setPreviewHotkeys(self, parent=None):
|
||||||
self.previousItem.setObjectName(u'previousItemPreview')
|
self.previousItem.setObjectName(u'previousItemPreview')
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
class MediaAPIs(object):
|
class MediaAPI(object):
|
||||||
"""
|
"""
|
||||||
An enumeration for possible APIs.
|
An enumeration for possible APIs.
|
||||||
"""
|
"""
|
||||||
@ -71,8 +71,10 @@ class MediaAPI(object):
|
|||||||
Specialiced Media API class
|
Specialiced Media API class
|
||||||
to reflect Features of the related API
|
to reflect Features of the related API
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent):
|
def __init__(self, parent, name=u'MediaApi'):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.name = name
|
||||||
|
self.available = self.check_available()
|
||||||
self.isActive = False
|
self.isActive = False
|
||||||
self.canBackground = False
|
self.canBackground = False
|
||||||
self.state = MediaState.Off
|
self.state = MediaState.Off
|
||||||
@ -80,6 +82,13 @@ class MediaAPI(object):
|
|||||||
self.audio_extensions_list = []
|
self.audio_extensions_list = []
|
||||||
self.video_extensions_list = []
|
self.video_extensions_list = []
|
||||||
|
|
||||||
|
def check_available(self):
|
||||||
|
"""
|
||||||
|
API is available on this machine
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def setup(self, display):
|
def setup(self, display):
|
||||||
"""
|
"""
|
||||||
Create the related widgets for the current display
|
Create the related widgets for the current display
|
||||||
@ -164,6 +173,26 @@ class MediaAPI(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def display_css(self):
|
||||||
|
"""
|
||||||
|
Add css style sheets to htmlbuilder
|
||||||
|
"""
|
||||||
|
return u''
|
||||||
|
|
||||||
|
|
||||||
|
def display_javascript(self):
|
||||||
|
"""
|
||||||
|
Add javascript functions to htmlbuilder
|
||||||
|
"""
|
||||||
|
return u''
|
||||||
|
|
||||||
|
|
||||||
|
def display_html(self):
|
||||||
|
"""
|
||||||
|
Add html code to htmlbuilder
|
||||||
|
"""
|
||||||
|
return u''
|
||||||
|
|
||||||
from mediaitem import MediaMediaItem
|
from mediaitem import MediaMediaItem
|
||||||
from mediatab import MediaTab
|
from mediatab import MediaTab
|
||||||
from mediamanager import MediaManager
|
from mediamanager import MediaManager
|
||||||
|
@ -92,7 +92,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
self.resetAction.setVisible(False)
|
self.resetAction.setVisible(False)
|
||||||
Receiver.send_message(u'media_reset',
|
Receiver.send_message(u'media_reset',
|
||||||
self.parent.liveController)
|
self.plugin.liveController)
|
||||||
|
|
||||||
def videobackgroundReplaced(self):
|
def videobackgroundReplaced(self):
|
||||||
"""
|
"""
|
||||||
@ -112,7 +112,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
Receiver.send_message(u'media_video',
|
Receiver.send_message(u'media_video',
|
||||||
[self.parent.liveController, filename, 0, True])
|
[self.plugin.liveController, filename, 0, True])
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
@ -139,7 +139,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
ItemCapabilities.AllowsVariableStartTime)
|
ItemCapabilities.AllowsVariableStartTime)
|
||||||
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||||
#Receiver.send_message(u'media_video', [self.parent.liveController, filename, False])
|
#Receiver.send_message(u'media_video', [self.plugin.liveController, filename, False])
|
||||||
# force a non-existent theme
|
# force a non-existent theme
|
||||||
service_item.theme = -1
|
service_item.theme = -1
|
||||||
frame = u':/media/image_clapperboard.png'
|
frame = u':/media/image_clapperboard.png'
|
||||||
|
@ -63,13 +63,6 @@ class MediaManager(object):
|
|||||||
self.APIs = {}
|
self.APIs = {}
|
||||||
self.controller = []
|
self.controller = []
|
||||||
self.curDisplayMediaAPI = {}
|
self.curDisplayMediaAPI = {}
|
||||||
#Create API Controllers
|
|
||||||
if WebkitAPI.is_available():
|
|
||||||
self.APIs[u'Webkit'] = WebkitAPI(self)
|
|
||||||
if PhononAPI.is_available():
|
|
||||||
self.APIs[u'Phonon'] = PhononAPI(self)
|
|
||||||
if VlcAPI.is_available():
|
|
||||||
self.APIs[u'Vlc'] = VlcAPI(self)
|
|
||||||
#Timer for video state
|
#Timer for video state
|
||||||
self.Timer = QtCore.QTimer()
|
self.Timer = QtCore.QTimer()
|
||||||
self.Timer.setInterval(200)
|
self.Timer.setInterval(200)
|
||||||
@ -117,6 +110,33 @@ class MediaManager(object):
|
|||||||
if not isAnyonePlaying:
|
if not isAnyonePlaying:
|
||||||
self.Timer.stop()
|
self.Timer.stop()
|
||||||
|
|
||||||
|
def display_css(self):
|
||||||
|
"""
|
||||||
|
Add css style sheets to htmlbuilder
|
||||||
|
"""
|
||||||
|
css = u'';
|
||||||
|
for api in self.APIs.values():
|
||||||
|
css+= api.display_css()
|
||||||
|
return css
|
||||||
|
|
||||||
|
def display_javascript(self):
|
||||||
|
"""
|
||||||
|
Add javascript functions to htmlbuilder
|
||||||
|
"""
|
||||||
|
js = u''
|
||||||
|
for api in self.APIs.values():
|
||||||
|
js+= api.display_javascript()
|
||||||
|
return js
|
||||||
|
|
||||||
|
def display_html(self):
|
||||||
|
"""
|
||||||
|
Add html code to htmlbuilder
|
||||||
|
"""
|
||||||
|
html = u''
|
||||||
|
for api in self.APIs.values():
|
||||||
|
html+= api.display_html()
|
||||||
|
return html
|
||||||
|
|
||||||
def addControllerItems(self, controller, control_panel):
|
def addControllerItems(self, controller, control_panel):
|
||||||
self.controller.append(controller)
|
self.controller.append(controller)
|
||||||
self.setup_generic_controls(controller, control_panel)
|
self.setup_generic_controls(controller, control_panel)
|
||||||
@ -133,11 +153,11 @@ class MediaManager(object):
|
|||||||
controller.sendToPlugins)
|
controller.sendToPlugins)
|
||||||
controller.mediabar.addToolbarButton(
|
controller.mediabar.addToolbarButton(
|
||||||
u'Media Pause', u':/slides/media_playback_pause.png',
|
u'Media Pause', u':/slides/media_playback_pause.png',
|
||||||
translate('OpenLP.SlideController', 'Start playing media'),
|
translate('OpenLP.SlideController', 'Pause playing media'),
|
||||||
controller.sendToPlugins)
|
controller.sendToPlugins)
|
||||||
controller.mediabar.addToolbarButton(
|
controller.mediabar.addToolbarButton(
|
||||||
u'Media Stop', u':/slides/media_playback_stop.png',
|
u'Media Stop', u':/slides/media_playback_stop.png',
|
||||||
translate('OpenLP.SlideController', 'Start playing media'),
|
translate('OpenLP.SlideController', 'Stop playing media'),
|
||||||
controller.sendToPlugins)
|
controller.sendToPlugins)
|
||||||
# Build the seekSlider.
|
# Build the seekSlider.
|
||||||
controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||||
|
@ -33,23 +33,26 @@ class MediaTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
MediaTab is the Media settings tab in the settings dialog.
|
MediaTab is the Media settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, title, visible_title, icon_path):
|
def __init__(self, parent, title, visible_title, apis, icon_path):
|
||||||
|
self.apis = apis
|
||||||
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setObjectName(u'MediaTab')
|
self.setObjectName(u'MediaTab')
|
||||||
SettingsTab.setupUi(self)
|
SettingsTab.setupUi(self)
|
||||||
self.mediaAPIsGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.mediaAPIGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.mediaAPIsGroupBox.setObjectName(u'mediaAPIsGroupBox')
|
self.mediaAPIGroupBox.setObjectName(u'mediaAPIGroupBox')
|
||||||
self.mediaApiLayout = QtGui.QVBoxLayout(self.mediaAPIsGroupBox)
|
self.mediaApiLayout = QtGui.QVBoxLayout(self.mediaAPIGroupBox)
|
||||||
self.mediaApiLayout.setObjectName(u'mediaApiLayout')
|
self.mediaApiLayout.setObjectName(u'mediaApiLayout')
|
||||||
self.usePhononCheckBox = QtGui.QCheckBox(self.mediaAPIsGroupBox)
|
self.ApiCheckBoxes = {}
|
||||||
self.usePhononCheckBox.setObjectName(u'usePhononCheckBox')
|
for key in self.apis:
|
||||||
self.mediaApiLayout.addWidget(self.usePhononCheckBox)
|
api = self.apis[key]
|
||||||
self.useVlcCheckBox = QtGui.QCheckBox(self.mediaAPIsGroupBox)
|
checkbox = QtGui.QCheckBox(self.mediaAPIGroupBox)
|
||||||
self.useVlcCheckBox.setObjectName(u'useVlcCheckBox')
|
checkbox.setEnabled(api.available)
|
||||||
self.mediaApiLayout.addWidget(self.useVlcCheckBox)
|
checkbox.setObjectName(api.name + u'CheckBox')
|
||||||
self.leftLayout.addWidget(self.mediaAPIsGroupBox)
|
self.ApiCheckBoxes[api.name] = checkbox
|
||||||
|
self.mediaApiLayout.addWidget(checkbox)
|
||||||
|
self.leftLayout.addWidget(self.mediaAPIGroupBox)
|
||||||
|
|
||||||
self.apiOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.apiOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.apiOrderGroupBox.setObjectName(u'apiOrderGroupBox')
|
self.apiOrderGroupBox.setObjectName(u'apiOrderGroupBox')
|
||||||
@ -87,24 +90,30 @@ class MediaTab(SettingsTab):
|
|||||||
self.leftLayout.addWidget(self.apiOrderGroupBox)
|
self.leftLayout.addWidget(self.apiOrderGroupBox)
|
||||||
self.leftLayout.addStretch()
|
self.leftLayout.addStretch()
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
QtCore.QObject.connect(self.usePhononCheckBox,
|
for key in self.apis:
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
api = self.apis[key]
|
||||||
self.onUsePhononCheckBoxChanged)
|
checkbox = self.ApiCheckBoxes[api.name]
|
||||||
QtCore.QObject.connect(self.useVlcCheckBox,
|
QtCore.QObject.connect(checkbox,
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
self.onUseVlcCheckBoxChanged)
|
self.onApiCheckBoxChanged)
|
||||||
|
|
||||||
QtCore.QObject.connect(self.orderingUpButton,
|
QtCore.QObject.connect(self.orderingUpButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onOrderingUpButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onOrderingUpButtonPressed)
|
||||||
QtCore.QObject.connect(self.orderingDownButton,
|
QtCore.QObject.connect(self.orderingDownButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.mediaAPIsGroupBox.setTitle(
|
self.mediaAPIGroupBox.setTitle(
|
||||||
translate('MediaPlugin.MediaTab', 'Media APIs'))
|
translate('MediaPlugin.MediaTab', 'Media APIs'))
|
||||||
self.usePhononCheckBox.setText(
|
for key in self.apis:
|
||||||
translate('MediaPlugin.MediaTab', 'use Phonon'))
|
api = self.apis[key]
|
||||||
self.useVlcCheckBox.setText(
|
checkbox = self.ApiCheckBoxes[api.name]
|
||||||
translate('MediaPlugin.MediaTab', 'use Vlc'))
|
if api.available:
|
||||||
|
checkbox.setText(api.name)
|
||||||
|
else:
|
||||||
|
checkbox.setText(
|
||||||
|
unicode(translate('MediaPlugin.MediaTab',
|
||||||
|
'%s (unavailable)')) % api.name)
|
||||||
self.apiOrderGroupBox.setTitle(
|
self.apiOrderGroupBox.setTitle(
|
||||||
translate('MediaPlugin.MediaTab', 'API Order'))
|
translate('MediaPlugin.MediaTab', 'API Order'))
|
||||||
self.orderingDownButton.setText(
|
self.orderingDownButton.setText(
|
||||||
@ -112,24 +121,13 @@ class MediaTab(SettingsTab):
|
|||||||
self.orderingUpButton.setText(
|
self.orderingUpButton.setText(
|
||||||
translate('MediaPlugin.MediaTab', 'Up'))
|
translate('MediaPlugin.MediaTab', 'Up'))
|
||||||
|
|
||||||
def onUsePhononCheckBoxChanged(self, check_state):
|
def onApiCheckBoxChanged(self, check_state):
|
||||||
|
api = self.sender().text()
|
||||||
if check_state == QtCore.Qt.Checked:
|
if check_state == QtCore.Qt.Checked:
|
||||||
self.usePhonon = True
|
if api not in self.usedAPIs:
|
||||||
if u'Phonon' not in self.usedAPIs:
|
self.usedAPIs.append(api)
|
||||||
self.usedAPIs.append(u'Phonon')
|
|
||||||
else:
|
else:
|
||||||
self.usePhonon = False
|
self.usedAPIs.takeAt(self.usedAPIs.indexOf(api))
|
||||||
self.usedAPIs.takeAt(self.usedAPIs.indexOf(u'Phonon'))
|
|
||||||
self.updateApiList()
|
|
||||||
|
|
||||||
def onUseVlcCheckBoxChanged(self, check_state):
|
|
||||||
if check_state == QtCore.Qt.Checked:
|
|
||||||
self.useVlc = True
|
|
||||||
if u'Vlc' not in self.usedAPIs:
|
|
||||||
self.usedAPIs.append(u'Vlc')
|
|
||||||
else:
|
|
||||||
self.useVlc = False
|
|
||||||
self.usedAPIs.takeAt(self.usedAPIs.indexOf(u'Vlc'))
|
|
||||||
self.updateApiList()
|
self.updateApiList()
|
||||||
|
|
||||||
def updateApiList(self):
|
def updateApiList(self):
|
||||||
@ -157,11 +155,11 @@ class MediaTab(SettingsTab):
|
|||||||
self.usedAPIs = QtCore.QSettings().value(
|
self.usedAPIs = QtCore.QSettings().value(
|
||||||
self.settingsSection + u'/apis',
|
self.settingsSection + u'/apis',
|
||||||
QtCore.QVariant(u'Webkit')).toString().split(u',')
|
QtCore.QVariant(u'Webkit')).toString().split(u',')
|
||||||
self.useWebkit = u'Webkit' in self.usedAPIs
|
for key in self.apis:
|
||||||
self.usePhonon = u'Phonon' in self.usedAPIs
|
api = self.apis[key]
|
||||||
self.useVlc = u'Vlc' in self.usedAPIs
|
checkbox = self.ApiCheckBoxes[api.name]
|
||||||
self.usePhononCheckBox.setChecked(self.usePhonon)
|
if api.available and api.name in self.usedAPIs:
|
||||||
self.useVlcCheckBox.setChecked(self.useVlc)
|
checkbox.setChecked(True)
|
||||||
self.updateApiList()
|
self.updateApiList()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
@ -44,7 +44,7 @@ class PhononAPI(MediaAPI):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
MediaAPI.__init__(self, parent)
|
MediaAPI.__init__(self, parent, u'Phonon')
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.additional_extensions = {
|
self.additional_extensions = {
|
||||||
u'audio/ac3': [u'.ac3'],
|
u'audio/ac3': [u'.ac3'],
|
||||||
@ -76,7 +76,7 @@ class PhononAPI(MediaAPI):
|
|||||||
ext = u'*%s' % extension
|
ext = u'*%s' % extension
|
||||||
if ext not in list:
|
if ext not in list:
|
||||||
list.append(ext)
|
list.append(ext)
|
||||||
self.parent.parent.serviceManager.supportedSuffixes(extension[1:])
|
self.parent.serviceManager.supportedSuffixes(extension[1:])
|
||||||
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
|
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
|
||||||
u' '.join(extensions)))
|
u' '.join(extensions)))
|
||||||
# Add extensions for this mimetype from self.additional_extensions.
|
# Add extensions for this mimetype from self.additional_extensions.
|
||||||
@ -87,7 +87,7 @@ class PhononAPI(MediaAPI):
|
|||||||
ext = u'*%s' % extension
|
ext = u'*%s' % extension
|
||||||
if ext not in list:
|
if ext not in list:
|
||||||
list.append(ext)
|
list.append(ext)
|
||||||
self.parent.parent.serviceManager.supportedSuffixes(extension[1:])
|
self.parent.serviceManager.supportedSuffixes(extension[1:])
|
||||||
log.info(u'MediaPlugin: %s additional extensions: %s' % (mimetype,
|
log.info(u'MediaPlugin: %s additional extensions: %s' % (mimetype,
|
||||||
u' '.join(self.additional_extensions[mimetype])))
|
u' '.join(self.additional_extensions[mimetype])))
|
||||||
|
|
||||||
@ -107,10 +107,7 @@ class PhononAPI(MediaAPI):
|
|||||||
display.phononWidget.hide()
|
display.phononWidget.hide()
|
||||||
self.hasOwnWidget = True
|
self.hasOwnWidget = True
|
||||||
|
|
||||||
@staticmethod
|
def check_available(self):
|
||||||
def is_available():
|
|
||||||
# usePhonon = QtCore.QSettings().value(
|
|
||||||
# u'media/use phonon', QtCore.QVariant(True)).toBool()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_supported_file_types(self):
|
def get_supported_file_types(self):
|
||||||
|
@ -30,8 +30,10 @@ import sys, os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
try:
|
try:
|
||||||
import vlc
|
import vlc
|
||||||
except:
|
vlc_available = True
|
||||||
pass
|
except ImportError:
|
||||||
|
vlc_available = False
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import Receiver
|
from openlp.core.lib import Receiver
|
||||||
from openlp.plugins.media.lib import MediaAPI, MediaState
|
from openlp.plugins.media.lib import MediaAPI, MediaState
|
||||||
@ -44,7 +46,7 @@ class VlcAPI(MediaAPI):
|
|||||||
to reflect Features of the Vlc API
|
to reflect Features of the Vlc API
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
MediaAPI.__init__(self, parent)
|
MediaAPI.__init__(self, parent, u'Vlc')
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.video_extensions_list = [
|
self.video_extensions_list = [
|
||||||
u'*.3gp'
|
u'*.3gp'
|
||||||
@ -99,13 +101,8 @@ class VlcAPI(MediaAPI):
|
|||||||
display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId()))
|
display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId()))
|
||||||
self.hasOwnWidget = True
|
self.hasOwnWidget = True
|
||||||
|
|
||||||
@staticmethod
|
def check_available(self):
|
||||||
def is_available():
|
return vlc_available
|
||||||
try:
|
|
||||||
import vlc
|
|
||||||
return True
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def get_supported_file_types(self):
|
def get_supported_file_types(self):
|
||||||
self.supported_file_types = ['avi']
|
self.supported_file_types = ['avi']
|
||||||
|
@ -41,7 +41,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
MediaAPI.__init__(self, parent)
|
MediaAPI.__init__(self, parent, u'Webkit')
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.canBackground = True
|
self.canBackground = True
|
||||||
self.video_extensions_list = [
|
self.video_extensions_list = [
|
||||||
@ -73,12 +73,194 @@ class WebkitAPI(MediaAPI):
|
|||||||
# no special controls
|
# no special controls
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def display_css(self):
|
||||||
|
"""
|
||||||
|
Add css style sheets to htmlbuilder
|
||||||
|
"""
|
||||||
|
css = u'''
|
||||||
|
'''
|
||||||
|
return css
|
||||||
|
|
||||||
|
|
||||||
|
def display_javascript(self):
|
||||||
|
"""
|
||||||
|
Add javascript functions to htmlbuilder
|
||||||
|
"""
|
||||||
|
js = u'''
|
||||||
|
var video_timer = null;
|
||||||
|
var current_video = '1';
|
||||||
|
|
||||||
|
function show_video(state, path, volume, loop, seekVal){
|
||||||
|
// Note, the preferred method for looping would be to use the
|
||||||
|
// video tag loop attribute.
|
||||||
|
// But QtWebKit doesn't support this. Neither does it support the
|
||||||
|
// onended event, hence the setInterval()
|
||||||
|
// In addition, setting the currentTime attribute to zero to restart
|
||||||
|
// the video raises an INDEX_SIZE_ERROR: DOM Exception 1
|
||||||
|
// To complicate it further, sometimes vid.currentTime stops
|
||||||
|
// slightly short of vid.duration and vid.ended is intermittent!
|
||||||
|
//
|
||||||
|
// Note, currently the background may go black between loops. Not
|
||||||
|
// desirable. Need to investigate using two <video>'s, and hiding/
|
||||||
|
// preloading one, and toggle between the two when looping.
|
||||||
|
|
||||||
|
if(current_video=='1'){
|
||||||
|
var vid = document.getElementById('video1');
|
||||||
|
var vid2 = document.getElementById('video2');
|
||||||
|
} else {
|
||||||
|
var vid = document.getElementById('video2');
|
||||||
|
var vid2 = document.getElementById('video1');
|
||||||
|
}
|
||||||
|
if(volume != null){
|
||||||
|
vid.volume = volume;
|
||||||
|
vid2.volume = volume;
|
||||||
|
}
|
||||||
|
switch(state){
|
||||||
|
case 'init':
|
||||||
|
vid.src = path;
|
||||||
|
vid2.src = path;
|
||||||
|
if(loop == null) loop = false;
|
||||||
|
vid.looping = loop;
|
||||||
|
vid2.looping = loop;
|
||||||
|
vid.load();
|
||||||
|
break;
|
||||||
|
case 'load':
|
||||||
|
vid2.style.visibility = 'hidden';
|
||||||
|
vid2.load();
|
||||||
|
break;
|
||||||
|
case 'play':
|
||||||
|
vid.play();
|
||||||
|
vid.style.visibility = 'visible';
|
||||||
|
if(vid.looping){
|
||||||
|
video_timer = setInterval(
|
||||||
|
function() {
|
||||||
|
show_video('poll');
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'pause':
|
||||||
|
if(video_timer!=null){
|
||||||
|
clearInterval(video_timer);
|
||||||
|
video_timer = null;
|
||||||
|
}
|
||||||
|
vid.pause();
|
||||||
|
break;
|
||||||
|
case 'stop':
|
||||||
|
show_video('pause');
|
||||||
|
vid.style.visibility = 'hidden';
|
||||||
|
break;
|
||||||
|
case 'poll':
|
||||||
|
if(vid.ended||vid.currentTime+0.2>vid.duration)
|
||||||
|
show_video('swap');
|
||||||
|
break;
|
||||||
|
case 'swap':
|
||||||
|
show_video('pause');
|
||||||
|
if(current_video=='1')
|
||||||
|
current_video = '2';
|
||||||
|
else
|
||||||
|
current_video = '1';
|
||||||
|
show_video('play');
|
||||||
|
show_video('load');
|
||||||
|
break;
|
||||||
|
case 'close':
|
||||||
|
show_video('stop');
|
||||||
|
vid.src = '';
|
||||||
|
vid2.src = '';
|
||||||
|
break;
|
||||||
|
case 'length':
|
||||||
|
return vid.duration;
|
||||||
|
case 'currentTime':
|
||||||
|
return vid.currentTime;
|
||||||
|
case 'seek':
|
||||||
|
// doesnt work curently
|
||||||
|
//vid.currentTime = seekVal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFlashMovieObject(movieName)
|
||||||
|
{
|
||||||
|
if (window.document[movieName])
|
||||||
|
{
|
||||||
|
return window.document[movieName];
|
||||||
|
}
|
||||||
|
if (document.embeds && document.embeds[movieName])
|
||||||
|
return document.embeds[movieName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html
|
||||||
|
function show_flash(state, path, volume, seekVal){
|
||||||
|
var text = document.getElementById('flash');
|
||||||
|
var flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||||
|
var src = "src = 'file:///" + path + "'";
|
||||||
|
var view_parm = " wmode='opaque'" +
|
||||||
|
" width='" + window.innerWidth + "'" +
|
||||||
|
" height='" + window.innerHeight + "'";
|
||||||
|
var swf_parm = " name='OpenLPFlashMovie'" +
|
||||||
|
" autostart='true' loop='false' play='true'" +
|
||||||
|
" hidden='false' swliveconnect='true' allowscriptaccess='always'" +
|
||||||
|
" volume='" + volume + "'";
|
||||||
|
|
||||||
|
switch(state){
|
||||||
|
case 'load':
|
||||||
|
text.innerHTML = "<embed " + src + view_parm + swf_parm + "/>";
|
||||||
|
flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||||
|
text.style.visibility = 'visible';
|
||||||
|
flashMovie.Play();
|
||||||
|
break;
|
||||||
|
case 'play':
|
||||||
|
text.style.visibility = 'visible';
|
||||||
|
flashMovie.Play();
|
||||||
|
break;
|
||||||
|
case 'pause':
|
||||||
|
flashMovie.StopPlay();
|
||||||
|
text.style.visibility = 'hidden';
|
||||||
|
break;
|
||||||
|
case 'stop':
|
||||||
|
flashMovie.StopPlay();
|
||||||
|
text.style.visibility = 'hidden';
|
||||||
|
tempHtml = text.innerHTML;
|
||||||
|
text.innerHTML = '';
|
||||||
|
text.innerHTML = tempHtml;
|
||||||
|
break;
|
||||||
|
case 'close':
|
||||||
|
flashMovie.StopPlay();
|
||||||
|
text.style.visibility = 'hidden';
|
||||||
|
text.innerHTML = '';
|
||||||
|
break;
|
||||||
|
case 'length':
|
||||||
|
return flashMovie.TotalFrames();
|
||||||
|
case 'currentTime':
|
||||||
|
return flashMovie.CurrentFrame();
|
||||||
|
case 'seek':
|
||||||
|
// flashMovie.GotoFrame(seekVal);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
return js
|
||||||
|
|
||||||
|
|
||||||
|
def display_html(self):
|
||||||
|
"""
|
||||||
|
Add html code to htmlbuilder
|
||||||
|
"""
|
||||||
|
html = u'''
|
||||||
|
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
|
||||||
|
</video>
|
||||||
|
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
|
||||||
|
</video>
|
||||||
|
<div id="flash" class="size" style="visibility:hidden"></div>
|
||||||
|
'''
|
||||||
|
return html
|
||||||
|
|
||||||
def setup(self, display):
|
def setup(self, display):
|
||||||
|
display.webView.resize(display.size())
|
||||||
display.webView.raise_()
|
display.webView.raise_()
|
||||||
self.hasOwnWidget = False
|
self.hasOwnWidget = False
|
||||||
|
display.webView.hide()
|
||||||
|
|
||||||
@staticmethod
|
def check_available(self):
|
||||||
def is_available():
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_supported_file_types(self):
|
def get_supported_file_types(self):
|
||||||
|
@ -26,9 +26,12 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||||
from openlp.plugins.media.lib import MediaMediaItem, MediaTab, MediaManager
|
from openlp.core.utils import AppLocation
|
||||||
|
from openlp.plugins.media.lib import MediaMediaItem, MediaTab, MediaManager, \
|
||||||
|
MediaAPI
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -37,7 +40,7 @@ class MediaPlugin(Plugin):
|
|||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
Plugin.__init__(self, u'Media', plugin_helpers,
|
Plugin.__init__(self, u'Media', plugin_helpers,
|
||||||
MediaMediaItem, MediaTab)
|
MediaMediaItem)
|
||||||
self.weight = -6
|
self.weight = -6
|
||||||
self.icon_path = u':/plugins/plugin_media.png'
|
self.icon_path = u':/plugins/plugin_media.png'
|
||||||
self.icon = build_icon(self.icon_path)
|
self.icon = build_icon(self.icon_path)
|
||||||
@ -49,6 +52,14 @@ class MediaPlugin(Plugin):
|
|||||||
self.video_extensions_list = \
|
self.video_extensions_list = \
|
||||||
self.mediaManager.get_video_extensions_list()
|
self.mediaManager.get_video_extensions_list()
|
||||||
|
|
||||||
|
def getSettingsTab(self, parent):
|
||||||
|
"""
|
||||||
|
Create the settings Tab
|
||||||
|
"""
|
||||||
|
visible_name = self.getString(StringContent.VisibleName)
|
||||||
|
return MediaTab(parent, self.name, visible_name[u'title'],
|
||||||
|
self.mediaManager.APIs, self.icon_path)
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
||||||
'<br />The media plugin provides playback of audio and video.')
|
'<br />The media plugin provides playback of audio and video.')
|
||||||
@ -92,3 +103,60 @@ class MediaPlugin(Plugin):
|
|||||||
self.mediaManager.Timer.stop()
|
self.mediaManager.Timer.stop()
|
||||||
self.mediaManager.video_reset(self.previewController)
|
self.mediaManager.video_reset(self.previewController)
|
||||||
self.mediaManager.video_reset(self.liveController)
|
self.mediaManager.video_reset(self.liveController)
|
||||||
|
|
||||||
|
def registerControllers(self, controller):
|
||||||
|
"""
|
||||||
|
Register each media API controller (Webkit, Phonon, etc) and
|
||||||
|
store for later use
|
||||||
|
"""
|
||||||
|
self.mediaManager.APIs[controller.name] = controller
|
||||||
|
#self.controllers[controller.name] = controller
|
||||||
|
|
||||||
|
def checkPreConditions(self):
|
||||||
|
"""
|
||||||
|
Check to see if we have any media API's available
|
||||||
|
If Not do not install the plugin.
|
||||||
|
"""
|
||||||
|
log.debug(u'checkPreConditions')
|
||||||
|
controller_dir = os.path.join(
|
||||||
|
AppLocation.get_directory(AppLocation.PluginsDir),
|
||||||
|
u'media', u'lib')
|
||||||
|
for filename in os.listdir(controller_dir):
|
||||||
|
if filename.endswith(u'api.py') and \
|
||||||
|
not filename == 'mediaapi.py':
|
||||||
|
path = os.path.join(controller_dir, filename)
|
||||||
|
if os.path.isfile(path):
|
||||||
|
modulename = u'openlp.plugins.media.lib.' + \
|
||||||
|
os.path.splitext(filename)[0]
|
||||||
|
log.debug(u'Importing controller %s', modulename)
|
||||||
|
try:
|
||||||
|
__import__(modulename, globals(), locals(), [])
|
||||||
|
except ImportError:
|
||||||
|
log.warn(u'Failed to import %s on path %s',
|
||||||
|
modulename, path)
|
||||||
|
controller_classes = MediaAPI.__subclasses__()
|
||||||
|
for controller_class in controller_classes:
|
||||||
|
controller = controller_class(self)
|
||||||
|
self.registerControllers(controller)
|
||||||
|
if self.mediaManager.APIs:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def display_css(self):
|
||||||
|
"""
|
||||||
|
Add css style sheets to htmlbuilder
|
||||||
|
"""
|
||||||
|
return self.mediaManager.display_css()
|
||||||
|
|
||||||
|
def display_javascript(self):
|
||||||
|
"""
|
||||||
|
Add javascript functions to htmlbuilder
|
||||||
|
"""
|
||||||
|
return self.mediaManager.display_javascript()
|
||||||
|
|
||||||
|
def display_html(self):
|
||||||
|
"""
|
||||||
|
Add html code to htmlbuilder
|
||||||
|
"""
|
||||||
|
return self.mediaManager.display_html()
|
||||||
|
Loading…
Reference in New Issue
Block a user