forked from openlp/openlp
bugfixing
This commit is contained in:
parent
509c0ba93d
commit
a2ebf30b68
@ -106,18 +106,14 @@ sup {
|
|||||||
function show_blank(state){
|
function show_blank(state){
|
||||||
var black = 'none';
|
var black = 'none';
|
||||||
var lyrics = '';
|
var lyrics = '';
|
||||||
var pause = false;
|
|
||||||
switch(state){
|
switch(state){
|
||||||
case 'theme':
|
case 'theme':
|
||||||
lyrics = 'hidden';
|
lyrics = 'hidden';
|
||||||
pause = true;
|
|
||||||
break;
|
break;
|
||||||
case 'black':
|
case 'black':
|
||||||
black = 'block';
|
black = 'block';
|
||||||
pause = true;
|
|
||||||
break;
|
break;
|
||||||
case 'desktop':
|
case 'desktop':
|
||||||
pause = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
document.getElementById('black').style.display = black;
|
document.getElementById('black').style.display = black;
|
||||||
@ -130,13 +126,6 @@ sup {
|
|||||||
if(shadow!=null)
|
if(shadow!=null)
|
||||||
shadow.style.visibility = lyrics;
|
shadow.style.visibility = lyrics;
|
||||||
document.getElementById('footer').style.visibility = lyrics;
|
document.getElementById('footer').style.visibility = lyrics;
|
||||||
var vid = document.getElementById('video');
|
|
||||||
if(vid.src != ''){
|
|
||||||
if(pause)
|
|
||||||
vid.pause();
|
|
||||||
else
|
|
||||||
vid.play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_alert(alerttext, position){
|
function show_alert(alerttext, position){
|
||||||
@ -220,7 +209,6 @@ sup {
|
|||||||
function show_text_complete(){
|
function show_text_complete(){
|
||||||
return (text_opacity()==1);
|
return (text_opacity()==1);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -235,8 +223,8 @@ sup {
|
|||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def build_html(item, screen, alert, islive, background, plugins=None,
|
def build_html(item, screen, alert, islive, background, image=None,
|
||||||
image=None):
|
plugins=None):
|
||||||
"""
|
"""
|
||||||
Build the full web paged structure for display
|
Build the full web paged structure for display
|
||||||
|
|
||||||
@ -255,11 +243,11 @@ def build_html(item, screen, alert, islive, background, plugins=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
|
||||||
|
|
||||||
|
``plugins``
|
||||||
|
The List of available plugins
|
||||||
"""
|
"""
|
||||||
width = screen[u'size'].width()
|
width = screen[u'size'].width()
|
||||||
height = screen[u'size'].height()
|
height = screen[u'size'].height()
|
||||||
|
@ -42,6 +42,13 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
log.info(u'Plugin manager loaded')
|
log.info(u'Plugin manager loaded')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_instance():
|
||||||
|
"""
|
||||||
|
Obtain a single instance of class.
|
||||||
|
"""
|
||||||
|
return PluginManager.instance
|
||||||
|
|
||||||
def __init__(self, plugin_dir):
|
def __init__(self, plugin_dir):
|
||||||
"""
|
"""
|
||||||
The constructor for the plugin manager. Passes the controllers on to
|
The constructor for the plugin manager. Passes the controllers on to
|
||||||
@ -51,6 +58,7 @@ class PluginManager(object):
|
|||||||
The directory to search for plugins.
|
The directory to search for plugins.
|
||||||
"""
|
"""
|
||||||
log.info(u'Plugin manager Initialising')
|
log.info(u'Plugin manager Initialising')
|
||||||
|
PluginManager.instance = self
|
||||||
if not plugin_dir in sys.path:
|
if not plugin_dir in sys.path:
|
||||||
log.debug(u'Inserting %s into sys.path', plugin_dir)
|
log.debug(u'Inserting %s into sys.path', plugin_dir)
|
||||||
sys.path.insert(0, plugin_dir)
|
sys.path.insert(0, plugin_dir)
|
||||||
|
@ -31,7 +31,7 @@ from PyQt4 import QtGui, QtCore, QtWebKit
|
|||||||
|
|
||||||
from openlp.core.lib import ServiceItem, expand_tags, \
|
from openlp.core.lib import ServiceItem, expand_tags, \
|
||||||
build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
||||||
ItemCapabilities, FormattingTags
|
ItemCapabilities, FormattingTags, PluginManager
|
||||||
from openlp.core.lib.theme import ThemeLevel
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.ui import MainDisplay, ScreenList
|
from openlp.core.ui import MainDisplay, ScreenList
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class Renderer(object):
|
|||||||
"""
|
"""
|
||||||
log.info(u'Renderer Loaded')
|
log.info(u'Renderer Loaded')
|
||||||
|
|
||||||
def __init__(self, imageManager, themeManager, plugins):
|
def __init__(self, imageManager, themeManager):
|
||||||
"""
|
"""
|
||||||
Initialise the renderer.
|
Initialise the renderer.
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class Renderer(object):
|
|||||||
log.debug(u'Initialisation started')
|
log.debug(u'Initialisation started')
|
||||||
self.themeManager = themeManager
|
self.themeManager = themeManager
|
||||||
self.imageManager = imageManager
|
self.imageManager = imageManager
|
||||||
self.plugins = plugins
|
self.plugins = PluginManager.get_instance().plugins
|
||||||
self.screens = ScreenList.get_instance()
|
self.screens = ScreenList.get_instance()
|
||||||
self.service_theme = u''
|
self.service_theme = u''
|
||||||
self.theme_level = u''
|
self.theme_level = u''
|
||||||
@ -77,8 +77,7 @@ class Renderer(object):
|
|||||||
self.theme_data = None
|
self.theme_data = None
|
||||||
self.bg_frame = None
|
self.bg_frame = None
|
||||||
self.force_page = False
|
self.force_page = False
|
||||||
self.display = MainDisplay(None, self.imageManager, False, self,
|
self.display = MainDisplay(None, self.imageManager, False, self)
|
||||||
self.plugins)
|
|
||||||
self.display.setup()
|
self.display.setup()
|
||||||
|
|
||||||
def update_display(self):
|
def update_display(self):
|
||||||
|
@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
|||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
||||||
translate
|
translate, PluginManager
|
||||||
|
|
||||||
from openlp.core.ui import HideMode, ScreenList
|
from openlp.core.ui import HideMode, ScreenList
|
||||||
|
|
||||||
@ -48,14 +48,14 @@ class Display(QtGui.QGraphicsView):
|
|||||||
"""
|
"""
|
||||||
This is a general display screen class.
|
This is a general display screen class.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, live, controller, plugins):
|
def __init__(self, parent, live, controller):
|
||||||
if live:
|
if live:
|
||||||
QtGui.QGraphicsView.__init__(self)
|
QtGui.QGraphicsView.__init__(self)
|
||||||
else:
|
else:
|
||||||
QtGui.QGraphicsView.__init__(self, parent)
|
QtGui.QGraphicsView.__init__(self, parent)
|
||||||
self.isLive = live
|
self.isLive = live
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
self.plugins = plugins
|
self.plugins = PluginManager.get_instance().plugins
|
||||||
self.setViewport(QtOpenGL.QGLWidget())
|
self.setViewport(QtOpenGL.QGLWidget())
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
@ -77,7 +77,7 @@ class Display(QtGui.QGraphicsView):
|
|||||||
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, self.plugins))
|
None, self.isLive, None))
|
||||||
self.webView.hide()
|
self.webView.hide()
|
||||||
|
|
||||||
def resizeEvent(self, ev):
|
def resizeEvent(self, ev):
|
||||||
@ -88,8 +88,8 @@ class MainDisplay(Display):
|
|||||||
"""
|
"""
|
||||||
This is the display screen.
|
This is the display screen.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, imageManager, live, controller, plugins):
|
def __init__(self, parent, imageManager, live, controller):
|
||||||
Display.__init__(self, parent, live, controller, plugins)
|
Display.__init__(self, parent, live, controller)
|
||||||
self.imageManager = imageManager
|
self.imageManager = imageManager
|
||||||
self.screens = ScreenList.get_instance()
|
self.screens = ScreenList.get_instance()
|
||||||
self.alertTab = None
|
self.alertTab = None
|
||||||
@ -177,7 +177,7 @@ class MainDisplay(Display):
|
|||||||
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.plugins))
|
self.alertTab, self.isLive, None, None, self.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']:
|
||||||
@ -367,7 +367,7 @@ class MainDisplay(Display):
|
|||||||
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, self.plugins, image_bytes)
|
self.isLive, background, image_bytes, self.plugins)
|
||||||
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')
|
||||||
|
@ -633,8 +633,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
# warning cyclic dependency
|
# warning cyclic dependency
|
||||||
# renderer needs to call ThemeManager and
|
# renderer needs to call ThemeManager and
|
||||||
# ThemeManager needs to call Renderer
|
# ThemeManager needs to call Renderer
|
||||||
self.renderer = Renderer(self.imageManager, self.themeManagerContents,
|
self.renderer = Renderer(self.imageManager, self.themeManagerContents)
|
||||||
self.pluginManager.plugins)
|
|
||||||
# Define the media Dock Manager
|
# Define the media Dock Manager
|
||||||
self.mediaDockManager = MediaDockManager(self.mediaToolBox)
|
self.mediaDockManager = MediaDockManager(self.mediaToolBox)
|
||||||
log.info(u'Load Plugins')
|
log.info(u'Load Plugins')
|
||||||
|
@ -39,6 +39,7 @@ class MediaState(object):
|
|||||||
|
|
||||||
class MediaType(object):
|
class MediaType(object):
|
||||||
"""
|
"""
|
||||||
|
An enumeration of possibible Media Types
|
||||||
"""
|
"""
|
||||||
Unused = 0
|
Unused = 0
|
||||||
Audio = 1
|
Audio = 1
|
||||||
|
@ -143,7 +143,7 @@ class MediaController(object):
|
|||||||
"""
|
"""
|
||||||
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.get_media_display_css()
|
css += api.get_media_display_css()
|
||||||
return css
|
return css
|
||||||
@ -263,6 +263,7 @@ class MediaController(object):
|
|||||||
controller.media_info.volume = controller.volumeSlider.value()
|
controller.media_info.volume = controller.volumeSlider.value()
|
||||||
controller.media_info.file_info = QtCore.QFileInfo(file)
|
controller.media_info.file_info = QtCore.QFileInfo(file)
|
||||||
controller.media_info.is_background = isBackground
|
controller.media_info.is_background = isBackground
|
||||||
|
display = None
|
||||||
if controller.isLive:
|
if controller.isLive:
|
||||||
if self.withLivePreview and controller.previewDisplay:
|
if self.withLivePreview and controller.previewDisplay:
|
||||||
display = controller.previewDisplay
|
display = controller.previewDisplay
|
||||||
@ -284,6 +285,7 @@ class MediaController(object):
|
|||||||
'Unsupported File')))
|
'Unsupported File')))
|
||||||
return False
|
return False
|
||||||
# now start playing
|
# now start playing
|
||||||
|
display.frame.evaluateJavaScript(u'show_blank("black");')
|
||||||
if self.video_play([controller], False):
|
if self.video_play([controller], False):
|
||||||
self.video_pause([controller])
|
self.video_pause([controller])
|
||||||
self.video_seek([controller, [0]])
|
self.video_seek([controller, [0]])
|
||||||
@ -358,6 +360,7 @@ class MediaController(object):
|
|||||||
if not self.curDisplayMediaAPI[display].play(display):
|
if not self.curDisplayMediaAPI[display].play(display):
|
||||||
return False
|
return False
|
||||||
if status:
|
if status:
|
||||||
|
display.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||||
self.curDisplayMediaAPI[display].set_visible(display, True)
|
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():
|
||||||
@ -382,6 +385,7 @@ class MediaController(object):
|
|||||||
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:
|
||||||
|
display.frame.evaluateJavaScript(u'show_blank("black");')
|
||||||
self.curDisplayMediaAPI[display].stop(display)
|
self.curDisplayMediaAPI[display].stop(display)
|
||||||
self.curDisplayMediaAPI[display].set_visible(display, False)
|
self.curDisplayMediaAPI[display].set_visible(display, False)
|
||||||
|
|
||||||
@ -440,7 +444,9 @@ class MediaController(object):
|
|||||||
Blank the related video Widget
|
Blank the related video Widget
|
||||||
"""
|
"""
|
||||||
isLive = msg[1]
|
isLive = msg[1]
|
||||||
|
hide_mode = msg[2]
|
||||||
if isLive:
|
if isLive:
|
||||||
|
Receiver.send_message(u'maindisplay_hide', hide_mode)
|
||||||
controller = self.parent.liveController
|
controller = self.parent.liveController
|
||||||
for display in self.curDisplayMediaAPI.keys():
|
for display in self.curDisplayMediaAPI.keys():
|
||||||
if display.controller == controller:
|
if display.controller == controller:
|
||||||
|
@ -34,7 +34,7 @@ from openlp.core.ui.media import MediaAPI, MediaState
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
video_css = u"""
|
VIDEO_CSS = u"""
|
||||||
#video1 {
|
#video1 {
|
||||||
z-index:3;
|
z-index:3;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ video_css = u"""
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
video_js = u"""
|
VIDEO_JS = u"""
|
||||||
var video_timer = null;
|
var video_timer = null;
|
||||||
var current_video = '1';
|
var current_video = '1';
|
||||||
|
|
||||||
@ -139,20 +139,20 @@ video_js = u"""
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
video_html = u"""
|
VIDEO_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>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
flash_css = u"""
|
FLASH_CSS = u"""
|
||||||
#flash {
|
#flash {
|
||||||
z-index:4;
|
z-index:4;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
flash_js = u"""
|
FLASH_JS = u"""
|
||||||
function getFlashMovieObject(movieName)
|
function getFlashMovieObject(movieName)
|
||||||
{
|
{
|
||||||
if (window.document[movieName])
|
if (window.document[movieName])
|
||||||
@ -211,7 +211,7 @@ flash_js = u"""
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
flash_html = u"""
|
FLASH_HTML = u"""
|
||||||
<div id="flash" class="size" style="visibility:hidden"></div>
|
<div id="flash" class="size" style="visibility:hidden"></div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -261,21 +261,21 @@ class WebkitAPI(MediaAPI):
|
|||||||
"""
|
"""
|
||||||
Add css style sheets to htmlbuilder
|
Add css style sheets to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return video_css + flash_css
|
return VIDEO_CSS + FLASH_CSS
|
||||||
|
|
||||||
|
|
||||||
def get_media_display_javascript(self):
|
def get_media_display_javascript(self):
|
||||||
"""
|
"""
|
||||||
Add javascript functions to htmlbuilder
|
Add javascript functions to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return video_js + flash_js
|
return VIDEO_JS + FLASH_JS
|
||||||
|
|
||||||
|
|
||||||
def get_media_display_html(self):
|
def get_media_display_html(self):
|
||||||
"""
|
"""
|
||||||
Add html code to htmlbuilder
|
Add html code to htmlbuilder
|
||||||
"""
|
"""
|
||||||
return video_html + flash_html
|
return VIDEO_HTML + FLASH_HTML
|
||||||
|
|
||||||
def setup(self, display):
|
def setup(self, display):
|
||||||
display.webView.resize(display.size())
|
display.webView.resize(display.size())
|
||||||
|
@ -286,7 +286,7 @@ class SlideController(Controller):
|
|||||||
self.slideLayout.setSpacing(0)
|
self.slideLayout.setSpacing(0)
|
||||||
self.slideLayout.setMargin(0)
|
self.slideLayout.setMargin(0)
|
||||||
self.slideLayout.setObjectName(u'SlideLayout')
|
self.slideLayout.setObjectName(u'SlideLayout')
|
||||||
self.previewDisplay = Display(self, self.isLive, self, self.parent().pluginManager.plugins)
|
self.previewDisplay = Display(self, self.isLive, self)
|
||||||
self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
|
self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
|
||||||
self.slideLayout.insertWidget(0, self.previewDisplay)
|
self.slideLayout.insertWidget(0, self.previewDisplay)
|
||||||
self.previewDisplay.hide()
|
self.previewDisplay.hide()
|
||||||
@ -404,7 +404,7 @@ class SlideController(Controller):
|
|||||||
if self.display:
|
if self.display:
|
||||||
self.display.close()
|
self.display.close()
|
||||||
self.display = MainDisplay(self, self.imageManager, self.isLive,
|
self.display = MainDisplay(self, self.imageManager, self.isLive,
|
||||||
self, self.parent().pluginManager.plugins)
|
self)
|
||||||
self.display.alertTab = self.alertTab
|
self.display.alertTab = self.alertTab
|
||||||
self.display.setup()
|
self.display.setup()
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
@ -528,7 +528,6 @@ class SlideController(Controller):
|
|||||||
if item.is_capable(ItemCapabilities.CanEdit) and item.from_plugin:
|
if item.is_capable(ItemCapabilities.CanEdit) and item.from_plugin:
|
||||||
self.toolbar.makeWidgetsVisible(self.songEditList)
|
self.toolbar.makeWidgetsVisible(self.songEditList)
|
||||||
elif item.is_media():
|
elif item.is_media():
|
||||||
#self.toolbar.setVisible(False)
|
|
||||||
self.mediabar.setVisible(True)
|
self.mediabar.setVisible(True)
|
||||||
self.previousItem.setVisible(False)
|
self.previousItem.setVisible(False)
|
||||||
self.nextItem.setVisible(False)
|
self.nextItem.setVisible(False)
|
||||||
|
Loading…
Reference in New Issue
Block a user