From 2c5bc34968a1ccf0b9c07ce6b7b443d7f0d02324 Mon Sep 17 00:00:00 2001 From: rimach Date: Tue, 30 Aug 2011 18:54:45 +0200 Subject: [PATCH] review changes part 2 --- openlp/core/lib/htmlbuilder.py | 13 +- openlp/core/lib/plugin.py | 2 +- openlp/core/ui/maindisplay.py | 2 +- openlp/core/ui/mainwindow.py | 6 +- openlp/core/ui/media/webkitapi.py | 360 +++++++++++++------------- openlp/core/ui/slidecontroller.py | 17 +- openlp/plugins/media/lib/mediaitem.py | 14 +- openlp/plugins/media/mediaplugin.py | 14 +- 8 files changed, 219 insertions(+), 209 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 113d15e2f..e38d78a6d 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -53,8 +53,8 @@ body { position: absolute; left: 0px; top: 0px; - width: 100%%;//%spx; - height: 100%%;//%spx; + width: 100%%; + height: 100%%; } #black { z-index: 8; @@ -285,9 +285,8 @@ def build_html(item, screen, alert, islive, background, plugins=None, \ js_additions += plugin.getDisplayJavaScript() html_additions += plugin.getDisplayHtml() html = HTMLSRC % (build_background_css(item, width, height), - width, height, css_additions, - build_alert_css(alert, width), + build_alert_css(alert), build_footer_css(item, height), build_lyrics_css(item, webkitvers), u'true' if theme and theme.display_slide_transition and islive \ @@ -555,7 +554,7 @@ def build_footer_css(item, height): theme.font_footer_size, theme.font_footer_color) return lyrics_html -def build_alert_css(alertTab, width): +def build_alert_css(alertTab): """ Build the display of the footer @@ -563,7 +562,7 @@ def build_alert_css(alertTab, width): Details from the Alert tab for fonts etc """ style = u""" - width: %spx; + width: 100%%; vertical-align: %s; font-family: %s; font-size: %spt; @@ -573,6 +572,6 @@ def build_alert_css(alertTab, width): if not alertTab: return u'' align = VerticalType.Names[alertTab.location] - alert = style % (width, align, alertTab.font_face, alertTab.font_size, + alert = style % (align, alertTab.font_face, alertTab.font_size, alertTab.font_color, alertTab.bg_color) return alert diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 53e22ad20..ce6c84de2 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -168,7 +168,7 @@ class Plugin(QtCore.QObject): self.mediadock = plugin_helpers[u'toolbox'] self.pluginManager = plugin_helpers[u'pluginmanager'] self.formparent = plugin_helpers[u'formparent'] - self.mediaManager = plugin_helpers[u'mediacontroller'] + self.mediaController = plugin_helpers[u'mediacontroller'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), self.processAddServiceEvent) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 3a8a44e11..803f8c45c 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -253,7 +253,7 @@ class MainDisplay(Display): """ log.debug(u'image to display') image = self.imageManager.get_image_bytes(name) - self.controller.mediaManager.video_reset(self.controller) + self.controller.mediaController.video_reset(self.controller) self.displayImage(image) return self.preview() diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4ca34f90a..26000fb75 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -148,7 +148,7 @@ class Ui_MainWindow(object): self.defaultThemeLabel = QtGui.QLabel(self.statusBar) self.defaultThemeLabel.setObjectName(u'defaultThemeLabel') self.statusBar.addPermanentWidget(self.defaultThemeLabel) - # Create the MediaController + # Create the MediaManager self.mediaManagerDock = OpenLPDockWidget(mainWindow, u'mediaManagerDock', u':/system/system_mediamanager.png') self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) @@ -557,7 +557,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.pluginManager = PluginManager(pluginpath) self.pluginHelpers = {} self.imageManager = ImageManager() - self.mediaManager = MediaController(self) + self.mediaController = MediaController(self) # Set up the interface self.setupUi(self) # Load settings after setupUi so default UI sizes are overwritten @@ -646,7 +646,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.pluginHelpers[u'toolbox'] = self.mediaDockManager self.pluginHelpers[u'pluginmanager'] = self.pluginManager self.pluginHelpers[u'formparent'] = self - self.pluginHelpers[u'mediacontroller'] = self.mediaManager + self.pluginHelpers[u'mediacontroller'] = self.mediaController self.pluginManager.find_plugins(pluginpath, self.pluginHelpers) # hook methods have to happen after find_plugins. Find plugins needs # the controllers hence the hooks have moved from setupUI() to here diff --git a/openlp/core/ui/media/webkitapi.py b/openlp/core/ui/media/webkitapi.py index 68ae02ab8..48a5a211b 100644 --- a/openlp/core/ui/media/webkitapi.py +++ b/openlp/core/ui/media/webkitapi.py @@ -34,9 +34,189 @@ from openlp.core.ui.media import MediaAPI, MediaState log = logging.getLogger(__name__) +video_css = u""" +#video1 { + z-index:3; +} +#video2 { + z-index:3; +} +""" + +video_js = u""" + var video_timer = null; + var current_video = '1'; + + function show_video(state, path, volume, loop, varVal){ + // 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