forked from openlp/openlp
bugfixing
This commit is contained in:
parent
229fe56305
commit
c547db5462
@ -36,6 +36,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
# FIXME: Add html5 doctype. However, do not break theme gradients.
|
# FIXME: Add html5 doctype. However, do not break theme gradients.
|
||||||
HTMLSRC = u"""
|
HTMLSRC = u"""
|
||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OpenLP Display</title>
|
<title>OpenLP Display</title>
|
||||||
@ -276,25 +277,25 @@ def build_html(item, screen, alert, islive, background, plugins=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''
|
css_additions = u''
|
||||||
plugin_js = u''
|
js_additions = u''
|
||||||
plugin_html = u''
|
html_additions = u''
|
||||||
if plugins:
|
if plugins:
|
||||||
for plugin in plugins:
|
for plugin in plugins:
|
||||||
plugin_css += plugin.getDisplayCss()
|
css_additions += plugin.getDisplayCss()
|
||||||
plugin_js += plugin.getDisplayJavascript()
|
js_additions += plugin.getDisplayJavascript()
|
||||||
plugin_html += plugin.getDisplayHtml()
|
html_additions += plugin.getDisplayHtml()
|
||||||
html = HTMLSRC % (build_background_css(item, width, height),
|
html = HTMLSRC % (build_background_css(item, width, height),
|
||||||
width, height,
|
width, height,
|
||||||
plugin_css,
|
css_additions,
|
||||||
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,
|
js_additions,
|
||||||
bgimage_src, image_src,
|
bgimage_src, image_src,
|
||||||
plugin_html,
|
html_additions,
|
||||||
build_lyrics_html(item, webkitvers))
|
build_lyrics_html(item, webkitvers))
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ class Display(QtGui.QGraphicsView):
|
|||||||
self.width(), self.height())
|
self.width(), self.height())
|
||||||
self.webView.settings().setAttribute(
|
self.webView.settings().setAttribute(
|
||||||
QtWebKit.QWebSettings.PluginsEnabled, True)
|
QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||||
|
self.webView.settings().setAttribute(7, True)
|
||||||
self.page = self.webView.page()
|
self.page = self.webView.page()
|
||||||
self.frame = self.page.mainFrame()
|
self.frame = self.page.mainFrame()
|
||||||
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
|
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
|
||||||
@ -129,6 +130,7 @@ class MainDisplay(Display):
|
|||||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||||
self.webView.settings().setAttribute( \
|
self.webView.settings().setAttribute( \
|
||||||
QtWebKit.QWebSettings.PluginsEnabled, True)
|
QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||||
|
self.webView.settings().setAttribute(7, True)
|
||||||
self.page = self.webView.page()
|
self.page = self.webView.page()
|
||||||
self.frame = self.page.mainFrame()
|
self.frame = self.page.mainFrame()
|
||||||
QtCore.QObject.connect(self.webView,
|
QtCore.QObject.connect(self.webView,
|
||||||
@ -253,7 +255,7 @@ class MainDisplay(Display):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'image to display')
|
log.debug(u'image to display')
|
||||||
image = self.imageManager.get_image_bytes(name)
|
image = self.imageManager.get_image_bytes(name)
|
||||||
self.resetVideo()
|
self.controller.mediaManager.video_reset(self.controller)
|
||||||
self.displayImage(image)
|
self.displayImage(image)
|
||||||
return self.preview()
|
return self.preview()
|
||||||
|
|
||||||
|
@ -39,10 +39,12 @@ class MediaState(object):
|
|||||||
class MediaType(object):
|
class MediaType(object):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
Audio = 0
|
Unused = 0
|
||||||
Video = 1
|
Audio = 1
|
||||||
|
Video = 2
|
||||||
Cd = 3
|
Cd = 3
|
||||||
Dvd = 4
|
Dvd = 4
|
||||||
|
Folder = 5
|
||||||
|
|
||||||
class MediaInfo(object):
|
class MediaInfo(object):
|
||||||
"""
|
"""
|
||||||
@ -50,7 +52,7 @@ class MediaInfo(object):
|
|||||||
"""
|
"""
|
||||||
file_info = None
|
file_info = None
|
||||||
volume = 100
|
volume = 100
|
||||||
isFlash = False
|
is_flash = False
|
||||||
is_background = False
|
is_background = False
|
||||||
length = 0
|
length = 0
|
||||||
start_time = 0
|
start_time = 0
|
||||||
|
@ -49,7 +49,6 @@ class MediaAPI(object):
|
|||||||
"""
|
"""
|
||||||
return False
|
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
|
||||||
@ -118,21 +117,19 @@ class MediaAPI(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getDisplayCss(self):
|
def get_media_display_css(self):
|
||||||
"""
|
"""
|
||||||
Add css style sheets to htmlbuilder
|
Add css style sheets to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return u''
|
return u''
|
||||||
|
|
||||||
|
def get_media_display_javascript(self):
|
||||||
def getDisplayJavascript(self):
|
|
||||||
"""
|
"""
|
||||||
Add javascript functions to htmlbuilder
|
Add javascript functions to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return u''
|
return u''
|
||||||
|
|
||||||
|
def get_media_display_html(self):
|
||||||
def getDisplayHtml(self):
|
|
||||||
"""
|
"""
|
||||||
Add html code to htmlbuilder
|
Add html code to htmlbuilder
|
||||||
"""
|
"""
|
||||||
|
@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit
|
|||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, Receiver, translate
|
from openlp.core.lib import OpenLPToolbar, Receiver, translate
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.ui.media import MediaAPI, MediaState, MediaInfo
|
from openlp.core.ui.media import MediaAPI, MediaState, MediaInfo, MediaType
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -61,12 +61,12 @@ class MediaManager(object):
|
|||||||
self.APIs = {}
|
self.APIs = {}
|
||||||
self.controller = []
|
self.controller = []
|
||||||
self.curDisplayMediaAPI = {}
|
self.curDisplayMediaAPI = {}
|
||||||
#Timer for video state
|
# Timer for video state
|
||||||
self.Timer = QtCore.QTimer()
|
self.Timer = QtCore.QTimer()
|
||||||
self.Timer.setInterval(200)
|
self.Timer.setInterval(200)
|
||||||
self.withLivePreview = False
|
self.withLivePreview = False
|
||||||
self.checkPreConditions()
|
self.check_available_media_apis()
|
||||||
#Signals
|
# Signals
|
||||||
QtCore.QObject.connect(self.Timer,
|
QtCore.QObject.connect(self.Timer,
|
||||||
QtCore.SIGNAL("timeout()"), self.video_state)
|
QtCore.SIGNAL("timeout()"), self.video_state)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -86,7 +86,7 @@ class MediaManager(object):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_unblank'), self.video_unblank)
|
QtCore.SIGNAL(u'media_unblank'), self.video_unblank)
|
||||||
|
|
||||||
def registerControllers(self, controller):
|
def register_controllers(self, controller):
|
||||||
"""
|
"""
|
||||||
Register each media API controller (Webkit, Phonon, etc) and
|
Register each media API controller (Webkit, Phonon, etc) and
|
||||||
store for later use
|
store for later use
|
||||||
@ -94,12 +94,12 @@ class MediaManager(object):
|
|||||||
if controller.check_available():
|
if controller.check_available():
|
||||||
self.APIs[controller.name] = controller
|
self.APIs[controller.name] = controller
|
||||||
|
|
||||||
def checkPreConditions(self):
|
def check_available_media_apis(self):
|
||||||
"""
|
"""
|
||||||
Check to see if we have any media API's available
|
Check to see if we have any media API's available
|
||||||
If Not do not install the plugin.
|
If Not do not install the plugin.
|
||||||
"""
|
"""
|
||||||
log.debug(u'checkPreConditions')
|
log.debug(u'check_available_media_apis')
|
||||||
controller_dir = os.path.join(
|
controller_dir = os.path.join(
|
||||||
AppLocation.get_directory(AppLocation.AppDir),
|
AppLocation.get_directory(AppLocation.AppDir),
|
||||||
u'core', u'ui', u'media')
|
u'core', u'ui', u'media')
|
||||||
@ -119,7 +119,7 @@ class MediaManager(object):
|
|||||||
controller_classes = MediaAPI.__subclasses__()
|
controller_classes = MediaAPI.__subclasses__()
|
||||||
for controller_class in controller_classes:
|
for controller_class in controller_classes:
|
||||||
controller = controller_class(self)
|
controller = controller_class(self)
|
||||||
self.registerControllers(controller)
|
self.register_controllers(controller)
|
||||||
if self.APIs:
|
if self.APIs:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@ -143,34 +143,34 @@ class MediaManager(object):
|
|||||||
if not isAnyonePlaying:
|
if not isAnyonePlaying:
|
||||||
self.Timer.stop()
|
self.Timer.stop()
|
||||||
|
|
||||||
def getDisplayCss(self):
|
def get_media_display_css(self):
|
||||||
"""
|
"""
|
||||||
Add css style sheets to htmlbuilder
|
Add css style sheets to htmlbuilder
|
||||||
"""
|
"""
|
||||||
css = u'';
|
css = u'';
|
||||||
for api in self.APIs.values():
|
for api in self.APIs.values():
|
||||||
css += api.getDisplayCss()
|
css += api.get_media_display_css()
|
||||||
return css
|
return css
|
||||||
|
|
||||||
def getDisplayJavascript(self):
|
def get_media_display_javascript(self):
|
||||||
"""
|
"""
|
||||||
Add javascript functions to htmlbuilder
|
Add javascript functions to htmlbuilder
|
||||||
"""
|
"""
|
||||||
js = u''
|
js = u''
|
||||||
for api in self.APIs.values():
|
for api in self.APIs.values():
|
||||||
js += api.getDisplayJavascript()
|
js += api.get_media_display_javascript()
|
||||||
return js
|
return js
|
||||||
|
|
||||||
def getDisplayHtml(self):
|
def get_media_display_html(self):
|
||||||
"""
|
"""
|
||||||
Add html code to htmlbuilder
|
Add html code to htmlbuilder
|
||||||
"""
|
"""
|
||||||
html = u''
|
html = u''
|
||||||
for api in self.APIs.values():
|
for api in self.APIs.values():
|
||||||
html += api.getDisplayHtml()
|
html += api.get_media_display_html()
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def addControllerItems(self, controller, control_panel):
|
def add_controller_items(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)
|
||||||
for api in self.APIs.values():
|
for api in self.APIs.values():
|
||||||
@ -210,7 +210,7 @@ class MediaManager(object):
|
|||||||
controller.mediabar.addToolbarWidget(u'Audio Volume', controller.volumeSlider)
|
controller.mediabar.addToolbarWidget(u'Audio Volume', controller.volumeSlider)
|
||||||
control_panel.addWidget(controller.mediabar)
|
control_panel.addWidget(controller.mediabar)
|
||||||
controller.mediabar.setVisible(False)
|
controller.mediabar.setVisible(False)
|
||||||
#Signals
|
# Signals
|
||||||
QtCore.QObject.connect(controller.seekSlider,
|
QtCore.QObject.connect(controller.seekSlider,
|
||||||
QtCore.SIGNAL(u'sliderMoved(int)'), controller.sendToPlugins)
|
QtCore.SIGNAL(u'sliderMoved(int)'), controller.sendToPlugins)
|
||||||
QtCore.QObject.connect(controller.volumeSlider,
|
QtCore.QObject.connect(controller.volumeSlider,
|
||||||
@ -277,20 +277,26 @@ class MediaManager(object):
|
|||||||
display = controller.previewDisplay
|
display = controller.previewDisplay
|
||||||
isValid = self.check_file_type(controller, display)
|
isValid = self.check_file_type(controller, display)
|
||||||
if not isValid:
|
if not isValid:
|
||||||
#Media could not be loaded correctly
|
# Media could not be loaded correctly
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||||
unicode(translate('MediaPlugin.MediaItem',
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
'Unsupported File')))
|
'Unsupported File')))
|
||||||
return False
|
return False
|
||||||
#now start playing
|
# now start playing
|
||||||
self.video_play([controller])
|
if self.video_play([controller]):
|
||||||
self.video_pause([controller])
|
self.video_pause([controller])
|
||||||
self.video_seek([controller, [0]])
|
self.video_seek([controller, [0]])
|
||||||
self.video_play([controller])
|
if self.video_play([controller]):
|
||||||
self.set_controls_visible(controller, True)
|
self.set_controls_visible(controller, True)
|
||||||
log.debug(u'use %s controller' % self.curDisplayMediaAPI[display])
|
log.debug(u'use %s controller' % self.curDisplayMediaAPI[display])
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
critical_error_message_box(
|
||||||
|
translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||||
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
|
'Unsupported File')))
|
||||||
|
return False
|
||||||
|
|
||||||
def check_file_type(self, controller, display):
|
def check_file_type(self, controller, display):
|
||||||
"""
|
"""
|
||||||
@ -310,7 +316,13 @@ class MediaManager(object):
|
|||||||
self.resize(controller, display, api)
|
self.resize(controller, display, api)
|
||||||
if api.load(display):
|
if api.load(display):
|
||||||
self.curDisplayMediaAPI[display] = api
|
self.curDisplayMediaAPI[display] = api
|
||||||
|
controller.media_info.media_type = MediaType.Video
|
||||||
return True
|
return True
|
||||||
|
if suffix in api.audio_extensions_list:
|
||||||
|
if api.load(display):
|
||||||
|
self.curDisplayMediaAPI[display] = api
|
||||||
|
controller.media_info.media_type = MediaType.Audio
|
||||||
|
return True
|
||||||
# no valid api found
|
# no valid api found
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -325,17 +337,19 @@ class MediaManager(object):
|
|||||||
if controller.isLive:
|
if controller.isLive:
|
||||||
if controller.hideMenu.defaultAction().isChecked():
|
if controller.hideMenu.defaultAction().isChecked():
|
||||||
controller.hideMenu.defaultAction().trigger()
|
controller.hideMenu.defaultAction().trigger()
|
||||||
#Receiver.send_message(u'maindisplay_show')
|
if not self.curDisplayMediaAPI[display].play(display):
|
||||||
self.curDisplayMediaAPI[display].play(display)
|
return False
|
||||||
|
self.curDisplayMediaAPI[display].set_visible(display, True)
|
||||||
# Start Timer for ui updates
|
# Start Timer for ui updates
|
||||||
if not self.Timer.isActive():
|
if not self.Timer.isActive():
|
||||||
self.Timer.start()
|
self.Timer.start()
|
||||||
|
return True
|
||||||
|
|
||||||
def video_pause(self, msg):
|
def video_pause(self, msg):
|
||||||
"""
|
"""
|
||||||
Responds to the request to pause a loaded video
|
Responds to the request to pause a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoPause')
|
log.debug(u'video_pause')
|
||||||
controller = msg[0]
|
controller = msg[0]
|
||||||
for display in self.curDisplayMediaAPI.keys():
|
for display in self.curDisplayMediaAPI.keys():
|
||||||
if display.controller == controller:
|
if display.controller == controller:
|
||||||
@ -383,6 +397,7 @@ class MediaManager(object):
|
|||||||
if display.controller == controller:
|
if display.controller == controller:
|
||||||
display.override = {}
|
display.override = {}
|
||||||
self.curDisplayMediaAPI[display].reset(display)
|
self.curDisplayMediaAPI[display].reset(display)
|
||||||
|
self.curDisplayMediaAPI[display].set_visible(display, False)
|
||||||
del self.curDisplayMediaAPI[display]
|
del self.curDisplayMediaAPI[display]
|
||||||
self.set_controls_visible(controller, False)
|
self.set_controls_visible(controller, False)
|
||||||
|
|
||||||
@ -428,9 +443,9 @@ class MediaManager(object):
|
|||||||
if display.controller == controller:
|
if display.controller == controller:
|
||||||
if self.curDisplayMediaAPI[display] \
|
if self.curDisplayMediaAPI[display] \
|
||||||
.state == MediaState.Paused:
|
.state == MediaState.Paused:
|
||||||
self.curDisplayMediaAPI[display].play(display)
|
if self.curDisplayMediaAPI[display].play(display):
|
||||||
self.curDisplayMediaAPI[display] \
|
self.curDisplayMediaAPI[display] \
|
||||||
.set_visible(display, True)
|
.set_visible(display, True)
|
||||||
|
|
||||||
def get_audio_extensions_list(self):
|
def get_audio_extensions_list(self):
|
||||||
audio_list = []
|
audio_list = []
|
||||||
|
@ -76,7 +76,6 @@ 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.serviceManagerContents.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 +86,6 @@ 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.serviceManagerContents.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])))
|
||||||
|
|
||||||
@ -133,19 +131,21 @@ class PhononAPI(MediaAPI):
|
|||||||
volume = controller.media_info.volume
|
volume = controller.media_info.volume
|
||||||
path = controller.media_info.file_info.absoluteFilePath()
|
path = controller.media_info.file_info.absoluteFilePath()
|
||||||
display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
|
display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
|
||||||
if not self.mediaStateWait(display, Phonon.StoppedState):
|
if not self.media_state_wait(display, Phonon.StoppedState):
|
||||||
return False
|
return False
|
||||||
self.volume(display, volume)
|
self.volume(display, volume)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def mediaStateWait(self, display, mediaState):
|
def media_state_wait(self, display, mediaState):
|
||||||
"""
|
"""
|
||||||
Wait for the video to change its state
|
Wait for the video to change its state
|
||||||
Wait no longer than 5 seconds.
|
Wait no longer than 5 seconds.
|
||||||
"""
|
"""
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
while display.mediaObject.state() != mediaState:
|
current_state = display.mediaObject.state()
|
||||||
if display.mediaObject.state() == Phonon.ErrorState:
|
while current_state != mediaState:
|
||||||
|
current_state = display.mediaObject.state()
|
||||||
|
if current_state == Phonon.ErrorState:
|
||||||
return False
|
return False
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
if (datetime.now() - start).seconds > 5:
|
if (datetime.now() - start).seconds > 5:
|
||||||
@ -162,7 +162,7 @@ class PhononAPI(MediaAPI):
|
|||||||
controller.media_info.start_time > 0:
|
controller.media_info.start_time > 0:
|
||||||
start_time = controller.media_info.start_time
|
start_time = controller.media_info.start_time
|
||||||
display.mediaObject.play()
|
display.mediaObject.play()
|
||||||
if self.mediaStateWait(display, Phonon.PlayingState):
|
if self.media_state_wait(display, Phonon.PlayingState):
|
||||||
if start_time > 0:
|
if start_time > 0:
|
||||||
self.seek(display, controller.media_info.start_time*1000)
|
self.seek(display, controller.media_info.start_time*1000)
|
||||||
self.volume(display, controller.media_info.volume)
|
self.volume(display, controller.media_info.volume)
|
||||||
@ -170,11 +170,15 @@ class PhononAPI(MediaAPI):
|
|||||||
int(display.mediaObject.totalTime()/1000)
|
int(display.mediaObject.totalTime()/1000)
|
||||||
controller.seekSlider.setMaximum(controller.media_info.length*1000)
|
controller.seekSlider.setMaximum(controller.media_info.length*1000)
|
||||||
self.state = MediaState.Playing
|
self.state = MediaState.Playing
|
||||||
self.set_visible(display, True)
|
#self.set_visible(display, True)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
display.mediaObject.pause()
|
display.mediaObject.pause()
|
||||||
self.state = MediaState.Paused
|
if self.media_state_wait(display, Phonon.PausedState):
|
||||||
|
self.state = MediaState.Paused
|
||||||
|
|
||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
display.mediaObject.stop()
|
display.mediaObject.stop()
|
||||||
|
@ -48,6 +48,11 @@ class VlcAPI(MediaAPI):
|
|||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
MediaAPI.__init__(self, parent, u'Vlc')
|
MediaAPI.__init__(self, parent, u'Vlc')
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.audio_extensions_list = [
|
||||||
|
u'*.mp3'
|
||||||
|
, u'*.wav'
|
||||||
|
, u'*.ogg'
|
||||||
|
]
|
||||||
self.video_extensions_list = [
|
self.video_extensions_list = [
|
||||||
u'*.3gp'
|
u'*.3gp'
|
||||||
, u'*.asf', u'*.wmv'
|
, u'*.asf', u'*.wmv'
|
||||||
@ -56,10 +61,10 @@ class VlcAPI(MediaAPI):
|
|||||||
, u'*.flv'
|
, u'*.flv'
|
||||||
, u'*.mov'
|
, u'*.mov'
|
||||||
, u'*.mp4'
|
, u'*.mp4'
|
||||||
, u'*.ogm', u'*.ogg'
|
, u'*.ogm'
|
||||||
, u'*.mkv', u'*.mka'
|
, u'*.mkv', u'*.mka'
|
||||||
, u'*.ts', u'*.mpg'
|
, u'*.ts', u'*.mpg'
|
||||||
, u'*.mpg', u'*.mp3', u'*.mp2'
|
, u'*.mpg', u'*.mp2'
|
||||||
, u'*.nsc'
|
, u'*.nsc'
|
||||||
, u'*.nsv'
|
, u'*.nsv'
|
||||||
, u'*.nut'
|
, u'*.nut'
|
||||||
@ -67,7 +72,7 @@ class VlcAPI(MediaAPI):
|
|||||||
, u'*.a52', u'*.dts', u'*.aac', u'*.flac' ,u'*.dv', u'*.vid'
|
, u'*.a52', u'*.dts', u'*.aac', u'*.flac' ,u'*.dv', u'*.vid'
|
||||||
, u'*.tta', u'*.tac'
|
, u'*.tta', u'*.tac'
|
||||||
, u'*.ty'
|
, u'*.ty'
|
||||||
, u'*.wav', u'*.dts'
|
, u'*.dts'
|
||||||
, u'*.xa'
|
, u'*.xa'
|
||||||
, u'*.iso'
|
, u'*.iso'
|
||||||
]
|
]
|
||||||
@ -120,7 +125,7 @@ class VlcAPI(MediaAPI):
|
|||||||
self.volume(display, volume)
|
self.volume(display, volume)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def mediaStateWait(self, display, mediaState):
|
def media_state_wait(self, display, mediaState):
|
||||||
"""
|
"""
|
||||||
Wait for the video to change its state
|
Wait for the video to change its state
|
||||||
Wait no longer than 5 seconds.
|
Wait no longer than 5 seconds.
|
||||||
@ -143,20 +148,23 @@ class VlcAPI(MediaAPI):
|
|||||||
if controller.media_info.start_time > 0:
|
if controller.media_info.start_time > 0:
|
||||||
start_time = controller.media_info.start_time
|
start_time = controller.media_info.start_time
|
||||||
display.vlcMediaPlayer.play()
|
display.vlcMediaPlayer.play()
|
||||||
if self.mediaStateWait(display, vlc.State.Playing):
|
if self.media_state_wait(display, vlc.State.Playing):
|
||||||
if start_time > 0:
|
if start_time > 0:
|
||||||
self.seek(display, controller.media_info.start_time*1000)
|
self.seek(display, controller.media_info.start_time*1000)
|
||||||
controller.media_info.length = \
|
controller.media_info.length = \
|
||||||
int(display.vlcMediaPlayer.get_media().get_duration()/1000)
|
int(display.vlcMediaPlayer.get_media().get_duration()/1000)
|
||||||
controller.seekSlider.setMaximum(controller.media_info.length*1000)
|
controller.seekSlider.setMaximum(controller.media_info.length*1000)
|
||||||
self.state = MediaState.Playing
|
self.state = MediaState.Playing
|
||||||
self.set_visible(display, True)
|
#self.set_visible(display, True)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
if display.vlcMedia.get_state() != vlc.State.Playing:
|
if display.vlcMedia.get_state() != vlc.State.Playing:
|
||||||
return
|
return
|
||||||
display.vlcMediaPlayer.pause()
|
display.vlcMediaPlayer.pause()
|
||||||
if self.mediaStateWait(display, vlc.State.Paused):
|
if self.media_state_wait(display, vlc.State.Paused):
|
||||||
self.state = MediaState.Paused
|
self.state = MediaState.Paused
|
||||||
|
|
||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
|
@ -44,6 +44,10 @@ class WebkitAPI(MediaAPI):
|
|||||||
MediaAPI.__init__(self, parent, u'Webkit')
|
MediaAPI.__init__(self, parent, u'Webkit')
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.canBackground = True
|
self.canBackground = True
|
||||||
|
self.audio_extensions_list = [
|
||||||
|
u'*.mp3'
|
||||||
|
, u'*.ogg'
|
||||||
|
]
|
||||||
self.video_extensions_list = [
|
self.video_extensions_list = [
|
||||||
u'*.3gp'
|
u'*.3gp'
|
||||||
, u'*.3gpp'
|
, u'*.3gpp'
|
||||||
@ -62,8 +66,6 @@ class WebkitAPI(MediaAPI):
|
|||||||
, u'*.m4v'
|
, u'*.m4v'
|
||||||
, u'*.mkv'
|
, u'*.mkv'
|
||||||
, u'*.mp4'
|
, u'*.mp4'
|
||||||
, u'*.mp3'
|
|
||||||
, u'*.ogg'
|
|
||||||
, u'*.ogv'
|
, u'*.ogv'
|
||||||
, u'*.webm'
|
, u'*.webm'
|
||||||
, u'*.swf', u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi'
|
, u'*.swf', u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi'
|
||||||
@ -73,7 +75,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
# no special controls
|
# no special controls
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getDisplayCss(self):
|
def get_media_display_css(self):
|
||||||
"""
|
"""
|
||||||
Add css style sheets to htmlbuilder
|
Add css style sheets to htmlbuilder
|
||||||
"""
|
"""
|
||||||
@ -91,7 +93,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
return css
|
return css
|
||||||
|
|
||||||
|
|
||||||
def getDisplayJavascript(self):
|
def get_media_display_javascript(self):
|
||||||
"""
|
"""
|
||||||
Add javascript functions to htmlbuilder
|
Add javascript functions to htmlbuilder
|
||||||
"""
|
"""
|
||||||
@ -99,7 +101,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
var video_timer = null;
|
var video_timer = null;
|
||||||
var current_video = '1';
|
var current_video = '1';
|
||||||
|
|
||||||
function show_video(state, path, volume, loop, seekVal){
|
function show_video(state, path, volume, loop, varVal){
|
||||||
// Note, the preferred method for looping would be to use the
|
// Note, the preferred method for looping would be to use the
|
||||||
// video tag loop attribute.
|
// video tag loop attribute.
|
||||||
// But QtWebKit doesn't support this. Neither does it support the
|
// But QtWebKit doesn't support this. Neither does it support the
|
||||||
@ -139,7 +141,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
break;
|
break;
|
||||||
case 'play':
|
case 'play':
|
||||||
vid.play();
|
vid.play();
|
||||||
vid.style.visibility = 'visible';
|
//vid.style.visibility = 'visible';
|
||||||
if(vid.looping){
|
if(vid.looping){
|
||||||
video_timer = setInterval(
|
video_timer = setInterval(
|
||||||
function() {
|
function() {
|
||||||
@ -156,7 +158,6 @@ class WebkitAPI(MediaAPI):
|
|||||||
break;
|
break;
|
||||||
case 'stop':
|
case 'stop':
|
||||||
show_video('pause');
|
show_video('pause');
|
||||||
vid.style.visibility = 'hidden';
|
|
||||||
break;
|
break;
|
||||||
case 'poll':
|
case 'poll':
|
||||||
if(vid.ended||vid.currentTime+0.2>vid.duration)
|
if(vid.ended||vid.currentTime+0.2>vid.duration)
|
||||||
@ -182,7 +183,10 @@ class WebkitAPI(MediaAPI):
|
|||||||
return vid.currentTime;
|
return vid.currentTime;
|
||||||
case 'seek':
|
case 'seek':
|
||||||
// doesnt work currently
|
// doesnt work currently
|
||||||
//vid.currentTime = seekVal;
|
//vid.currentTime = varVal;
|
||||||
|
break;
|
||||||
|
case 'setVisible':
|
||||||
|
vid.style.visibility = varVal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,8 +201,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
return document.embeds[movieName];
|
return document.embeds[movieName];
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html
|
function show_flash(state, path, volume, varVal){
|
||||||
function show_flash(state, path, volume, seekVal){
|
|
||||||
var text = document.getElementById('flash');
|
var text = document.getElementById('flash');
|
||||||
var flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
var flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||||
var src = "src = 'file:///" + path + "'";
|
var src = "src = 'file:///" + path + "'";
|
||||||
@ -214,27 +217,22 @@ class WebkitAPI(MediaAPI):
|
|||||||
case 'load':
|
case 'load':
|
||||||
text.innerHTML = "<embed " + src + view_parm + swf_parm + "/>";
|
text.innerHTML = "<embed " + src + view_parm + swf_parm + "/>";
|
||||||
flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||||
text.style.visibility = 'visible';
|
|
||||||
flashMovie.Play();
|
flashMovie.Play();
|
||||||
break;
|
break;
|
||||||
case 'play':
|
case 'play':
|
||||||
text.style.visibility = 'visible';
|
|
||||||
flashMovie.Play();
|
flashMovie.Play();
|
||||||
break;
|
break;
|
||||||
case 'pause':
|
case 'pause':
|
||||||
flashMovie.StopPlay();
|
flashMovie.StopPlay();
|
||||||
text.style.visibility = 'hidden';
|
|
||||||
break;
|
break;
|
||||||
case 'stop':
|
case 'stop':
|
||||||
flashMovie.StopPlay();
|
flashMovie.StopPlay();
|
||||||
text.style.visibility = 'hidden';
|
|
||||||
tempHtml = text.innerHTML;
|
tempHtml = text.innerHTML;
|
||||||
text.innerHTML = '';
|
text.innerHTML = '';
|
||||||
text.innerHTML = tempHtml;
|
text.innerHTML = tempHtml;
|
||||||
break;
|
break;
|
||||||
case 'close':
|
case 'close':
|
||||||
flashMovie.StopPlay();
|
flashMovie.StopPlay();
|
||||||
text.style.visibility = 'hidden';
|
|
||||||
text.innerHTML = '';
|
text.innerHTML = '';
|
||||||
break;
|
break;
|
||||||
case 'length':
|
case 'length':
|
||||||
@ -242,7 +240,10 @@ class WebkitAPI(MediaAPI):
|
|||||||
case 'currentTime':
|
case 'currentTime':
|
||||||
return flashMovie.CurrentFrame();
|
return flashMovie.CurrentFrame();
|
||||||
case 'seek':
|
case 'seek':
|
||||||
// flashMovie.GotoFrame(seekVal);
|
// flashMovie.GotoFrame(varVal);
|
||||||
|
break;
|
||||||
|
case 'setVisible':
|
||||||
|
text.style.visibility = varVal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,16 +251,16 @@ class WebkitAPI(MediaAPI):
|
|||||||
return js
|
return js
|
||||||
|
|
||||||
|
|
||||||
def getDisplayHtml(self):
|
def get_media_display_html(self):
|
||||||
"""
|
"""
|
||||||
Add html code to htmlbuilder
|
Add html code to htmlbuilder
|
||||||
"""
|
"""
|
||||||
html = u'''
|
html = u'''
|
||||||
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
|
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
|
||||||
</video>
|
</video>
|
||||||
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
|
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
|
||||||
</video>
|
</video>
|
||||||
<div id="flash" class="size" style="visibility:hidden"></div>
|
<div id="flash" class="size" style="visibility:hidden"></div>
|
||||||
'''
|
'''
|
||||||
return html
|
return html
|
||||||
|
|
||||||
@ -267,7 +268,6 @@ class WebkitAPI(MediaAPI):
|
|||||||
display.webView.resize(display.size())
|
display.webView.resize(display.size())
|
||||||
display.webView.raise_()
|
display.webView.raise_()
|
||||||
self.hasOwnWidget = False
|
self.hasOwnWidget = False
|
||||||
#display.webView.hide()
|
|
||||||
|
|
||||||
def check_available(self):
|
def check_available(self):
|
||||||
return True
|
return True
|
||||||
@ -287,7 +287,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
loop = u'false'
|
loop = u'false'
|
||||||
display.webView.setVisible(True)
|
display.webView.setVisible(True)
|
||||||
if controller.media_info.file_info.suffix() == u'swf':
|
if controller.media_info.file_info.suffix() == u'swf':
|
||||||
controller.media_info.isFlash = True
|
controller.media_info.is_flash = True
|
||||||
js = u'show_flash("load","%s");' % \
|
js = u'show_flash("load","%s");' % \
|
||||||
(path.replace(u'\\', u'\\\\'))
|
(path.replace(u'\\', u'\\\\'))
|
||||||
else:
|
else:
|
||||||
@ -305,17 +305,18 @@ class WebkitAPI(MediaAPI):
|
|||||||
display.webLoaded = True
|
display.webLoaded = True
|
||||||
length = 0
|
length = 0
|
||||||
self.set_visible(display, True)
|
self.set_visible(display, True)
|
||||||
if controller.media_info.isFlash:
|
if controller.media_info.is_flash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("play");')
|
display.frame.evaluateJavaScript(u'show_flash("play");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("play");')
|
display.frame.evaluateJavaScript(u'show_video("play");')
|
||||||
#TODO add playing check and get the correct media length
|
# TODO add playing check and get the correct media length
|
||||||
controller.media_info.length = length
|
controller.media_info.length = length
|
||||||
self.state = MediaState.Playing
|
self.state = MediaState.Playing
|
||||||
|
return True
|
||||||
|
|
||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.isFlash:
|
if controller.media_info.is_flash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("pause");')
|
display.frame.evaluateJavaScript(u'show_flash("pause");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("pause");')
|
display.frame.evaluateJavaScript(u'show_video("pause");')
|
||||||
@ -323,7 +324,7 @@ class WebkitAPI(MediaAPI):
|
|||||||
|
|
||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.isFlash:
|
if controller.media_info.is_flash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("stop");')
|
display.frame.evaluateJavaScript(u'show_flash("stop");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("stop");')
|
display.frame.evaluateJavaScript(u'show_video("stop");')
|
||||||
@ -334,13 +335,13 @@ class WebkitAPI(MediaAPI):
|
|||||||
# 1.0 is the highest value
|
# 1.0 is the highest value
|
||||||
if display.hasAudio:
|
if display.hasAudio:
|
||||||
vol = float(vol) / float(100)
|
vol = float(vol) / float(100)
|
||||||
if not controller.media_info.isFlash:
|
if not controller.media_info.is_flash:
|
||||||
display.frame.evaluateJavaScript(
|
display.frame.evaluateJavaScript(
|
||||||
u'show_video(null, null, %s);' % str(vol))
|
u'show_video(null, null, %s);' % str(vol))
|
||||||
|
|
||||||
def seek(self, display, seekVal):
|
def seek(self, display, seekVal):
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.isFlash:
|
if controller.media_info.is_flash:
|
||||||
seek = seekVal
|
seek = seekVal
|
||||||
display.frame.evaluateJavaScript( \
|
display.frame.evaluateJavaScript( \
|
||||||
u'show_flash("seek", null, null, "%s");' % (seek))
|
u'show_flash("seek", null, null, "%s");' % (seek))
|
||||||
@ -351,19 +352,28 @@ class WebkitAPI(MediaAPI):
|
|||||||
|
|
||||||
def reset(self, display):
|
def reset(self, display):
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.isFlash:
|
if controller.media_info.is_flash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("close");')
|
display.frame.evaluateJavaScript(u'show_flash("close");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("close");')
|
display.frame.evaluateJavaScript(u'show_video("close");')
|
||||||
self.state = MediaState.Off
|
self.state = MediaState.Off
|
||||||
|
|
||||||
def set_visible(self, display, status):
|
def set_visible(self, display, status):
|
||||||
if self.hasOwnWidget:
|
controller = display.controller
|
||||||
display.webView.setVisible(status)
|
if status:
|
||||||
|
is_visible = "visible"
|
||||||
|
else:
|
||||||
|
is_visible = "hidden"
|
||||||
|
if controller.media_info.is_flash:
|
||||||
|
display.frame.evaluateJavaScript(u'show_flash( \
|
||||||
|
"setVisible", null, null, "%s");' % (is_visible))
|
||||||
|
else:
|
||||||
|
display.frame.evaluateJavaScript(u'show_video( \
|
||||||
|
"setVisible", null, null, null, "%s");' % (is_visible))
|
||||||
|
|
||||||
def update_ui(self, display):
|
def update_ui(self, display):
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.isFlash:
|
if controller.media_info.is_flash:
|
||||||
currentTime = display.frame.evaluateJavaScript( \
|
currentTime = display.frame.evaluateJavaScript( \
|
||||||
u'show_flash("currentTime");').toInt()[0]
|
u'show_flash("currentTime");').toInt()[0]
|
||||||
length = display.frame.evaluateJavaScript( \
|
length = display.frame.evaluateJavaScript( \
|
||||||
@ -372,12 +382,12 @@ class WebkitAPI(MediaAPI):
|
|||||||
(currentTime, ok) = display.frame.evaluateJavaScript( \
|
(currentTime, ok) = display.frame.evaluateJavaScript( \
|
||||||
u'show_video("currentTime");').toFloat()
|
u'show_video("currentTime");').toFloat()
|
||||||
# check if conversion was ok and value is not 'NaN'
|
# check if conversion was ok and value is not 'NaN'
|
||||||
if ok and currentTime == currentTime:
|
if ok and currentTime != float('inf'):
|
||||||
currentTime = int(currentTime*1000)
|
currentTime = int(currentTime*1000)
|
||||||
(length, ok) = display.frame.evaluateJavaScript( \
|
(length, ok) = display.frame.evaluateJavaScript( \
|
||||||
u'show_video("length");').toFloat()
|
u'show_video("length");').toFloat()
|
||||||
# check if conversion was ok and value is not 'NaN'
|
# check if conversion was ok and value is not 'NaN'
|
||||||
if ok and length == length:
|
if ok and length != float('inf'):
|
||||||
length = int(length*1000)
|
length = int(length*1000)
|
||||||
if currentTime > 0:
|
if currentTime > 0:
|
||||||
controller.media_info.length = length
|
controller.media_info.length = length
|
||||||
|
@ -253,7 +253,7 @@ class SlideController(Controller):
|
|||||||
self.onEditSong)
|
self.onEditSong)
|
||||||
self.controllerLayout.addWidget(self.toolbar)
|
self.controllerLayout.addWidget(self.toolbar)
|
||||||
# Build the Media Toolbar
|
# Build the Media Toolbar
|
||||||
self.mediaManager.addControllerItems(self, self.controllerLayout)
|
self.mediaManager.add_controller_items(self, self.controllerLayout)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
# Build the Song Toolbar
|
# Build the Song Toolbar
|
||||||
self.songMenu = QtGui.QToolButton(self.toolbar)
|
self.songMenu = QtGui.QToolButton(self.toolbar)
|
||||||
@ -501,7 +501,7 @@ class SlideController(Controller):
|
|||||||
self.playSlidesOnce.setChecked(False)
|
self.playSlidesOnce.setChecked(False)
|
||||||
self.playSlidesOnce.setIcon(build_icon(u':/media/media_time.png'))
|
self.playSlidesOnce.setIcon(build_icon(u':/media/media_time.png'))
|
||||||
self.playSlidesLoop.setChecked(False)
|
self.playSlidesLoop.setChecked(False)
|
||||||
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
|
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
|
||||||
if item.is_text():
|
if item.is_text():
|
||||||
if QtCore.QSettings().value(
|
if QtCore.QSettings().value(
|
||||||
self.parent().songsSettingsSection + u'/display songbar',
|
self.parent().songsSettingsSection + u'/display songbar',
|
||||||
@ -512,9 +512,13 @@ class SlideController(Controller):
|
|||||||
self.toolbar.makeWidgetsVisible(self.loopList)
|
self.toolbar.makeWidgetsVisible(self.loopList)
|
||||||
if item.is_media():
|
if item.is_media():
|
||||||
self.mediabar.setVisible(True)
|
self.mediabar.setVisible(True)
|
||||||
|
self.previousItem.setVisible(False)
|
||||||
|
self.nextItem.setVisible(False)
|
||||||
else:
|
else:
|
||||||
# Work-around for OS X, hide and then show the toolbar
|
# Work-around for OS X, hide and then show the toolbar
|
||||||
# See bug #791050
|
# See bug #791050
|
||||||
|
self.previousItem.setVisible(True)
|
||||||
|
self.nextItem.setVisible(True)
|
||||||
self.toolbar.show()
|
self.toolbar.show()
|
||||||
self.toolbar.show()
|
self.toolbar.show()
|
||||||
|
|
||||||
|
@ -56,11 +56,15 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.mediaObject = None
|
self.mediaObject = None
|
||||||
self.mediaController = Controller(parent)
|
self.mediaController = Controller(parent)
|
||||||
self.mediaController.controllerLayout = QtGui.QVBoxLayout()
|
self.mediaController.controllerLayout = QtGui.QVBoxLayout()
|
||||||
self.plugin.mediaManager.addControllerItems(self.mediaController, self.mediaController.controllerLayout)
|
self.plugin.mediaManager.add_controller_items(self.mediaController, \
|
||||||
self.plugin.mediaManager.set_controls_visible(self.mediaController, False)
|
self.mediaController.controllerLayout)
|
||||||
self.mediaController.previewDisplay = Display(self.mediaController, False, self.mediaController, self.plugin.pluginManager.plugins)
|
self.plugin.mediaManager.set_controls_visible(self.mediaController, \
|
||||||
|
False)
|
||||||
|
self.mediaController.previewDisplay = Display(self.mediaController, \
|
||||||
|
False, self.mediaController, self.plugin.pluginManager.plugins)
|
||||||
self.mediaController.previewDisplay.setup()
|
self.mediaController.previewDisplay.setup()
|
||||||
self.plugin.mediaManager.setup_display(self.mediaController.previewDisplay)
|
self.plugin.mediaManager.setup_display( \
|
||||||
|
self.mediaController.previewDisplay)
|
||||||
self.mediaController.previewDisplay.hide()
|
self.mediaController.previewDisplay.hide()
|
||||||
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -100,7 +104,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def onResetClick(self):
|
def onResetClick(self):
|
||||||
"""
|
"""
|
||||||
Called to reset the Live backgound with the media selected,
|
Called to reset the Live background with the media selected,
|
||||||
"""
|
"""
|
||||||
self.plugin.liveController.mediaManager.video_reset( \
|
self.plugin.liveController.mediaManager.video_reset( \
|
||||||
self.plugin.liveController)
|
self.plugin.liveController)
|
||||||
@ -114,7 +118,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def onReplaceClick(self):
|
def onReplaceClick(self):
|
||||||
"""
|
"""
|
||||||
Called to replace Live backgound with the media selected.
|
Called to replace Live background with the media selected.
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView,
|
||||||
translate('MediaPlugin.MediaItem',
|
translate('MediaPlugin.MediaItem',
|
||||||
@ -122,7 +126,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
(path, name) = os.path.split(filename)
|
#(path, name) = os.path.split(filename)
|
||||||
if self.plugin.liveController.mediaManager.video( \
|
if self.plugin.liveController.mediaManager.video( \
|
||||||
self.plugin.liveController, filename, True, True):
|
self.plugin.liveController, filename, True, True):
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
@ -158,6 +162,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
if self.mediaLength > 0:
|
if self.mediaLength > 0:
|
||||||
service_item.add_capability(
|
service_item.add_capability(
|
||||||
ItemCapabilities.AllowsVariableStartTime)
|
ItemCapabilities.AllowsVariableStartTime)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
service_item.media_length = self.mediaLength
|
service_item.media_length = self.mediaLength
|
||||||
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)
|
||||||
|
@ -53,7 +53,6 @@ class MediaTab(SettingsTab):
|
|||||||
self.ApiCheckBoxes[api.name] = checkbox
|
self.ApiCheckBoxes[api.name] = checkbox
|
||||||
self.mediaApiLayout.addWidget(checkbox)
|
self.mediaApiLayout.addWidget(checkbox)
|
||||||
self.leftLayout.addWidget(self.mediaAPIGroupBox)
|
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')
|
||||||
self.apiOrderLayout = QtGui.QVBoxLayout(self.apiOrderGroupBox)
|
self.apiOrderLayout = QtGui.QVBoxLayout(self.apiOrderGroupBox)
|
||||||
@ -67,7 +66,6 @@ class MediaTab(SettingsTab):
|
|||||||
sizePolicy.setHeightForWidth(self.apiOrderlistWidget. \
|
sizePolicy.setHeightForWidth(self.apiOrderlistWidget. \
|
||||||
sizePolicy().hasHeightForWidth())
|
sizePolicy().hasHeightForWidth())
|
||||||
self.apiOrderlistWidget.setSizePolicy(sizePolicy)
|
self.apiOrderlistWidget.setSizePolicy(sizePolicy)
|
||||||
|
|
||||||
self.apiOrderlistWidget.setVerticalScrollBarPolicy( \
|
self.apiOrderlistWidget.setVerticalScrollBarPolicy( \
|
||||||
QtCore.Qt.ScrollBarAsNeeded)
|
QtCore.Qt.ScrollBarAsNeeded)
|
||||||
self.apiOrderlistWidget.setHorizontalScrollBarPolicy( \
|
self.apiOrderlistWidget.setHorizontalScrollBarPolicy( \
|
||||||
|
@ -99,21 +99,22 @@ class MediaPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
log.info(u'Media Finalising')
|
log.info(u'Media Finalising')
|
||||||
self.mediaManager.finalise()
|
self.mediaManager.finalise()
|
||||||
|
Plugin.finalise(self)
|
||||||
|
|
||||||
def getDisplayCss(self):
|
def getDisplayCss(self):
|
||||||
"""
|
"""
|
||||||
Add css style sheets to htmlbuilder
|
Add css style sheets to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return self.mediaManager.getDisplayCss()
|
return self.mediaManager.get_media_display_css()
|
||||||
|
|
||||||
def getDisplayJavascript(self):
|
def getDisplayJavascript(self):
|
||||||
"""
|
"""
|
||||||
Add javascript functions to htmlbuilder
|
Add javascript functions to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return self.mediaManager.getDisplayJavascript()
|
return self.mediaManager.get_media_display_javascript()
|
||||||
|
|
||||||
def getDisplayHtml(self):
|
def getDisplayHtml(self):
|
||||||
"""
|
"""
|
||||||
Add html code to htmlbuilder
|
Add html code to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return self.mediaManager.getDisplayHtml()
|
return self.mediaManager.get_media_display_html()
|
||||||
|
Loading…
Reference in New Issue
Block a user