Head 1785

This commit is contained in:
M2j 2011-10-25 22:35:44 +02:00
commit 69f29c0ef3
39 changed files with 4902 additions and 3998 deletions

View File

@ -143,7 +143,7 @@ class OpenLP(QtGui.QApplication):
u'general/update check', QtCore.QVariant(True)).toBool()
if update_check:
VersionThread(self.mainWindow).start()
Receiver.send_message(u'maindisplay_blank_check')
Receiver.send_message(u'live_display_blank_check')
self.mainWindow.appStartup()
DelayStartThread(self.mainWindow).start()
# Skip exec_() for gui tests

View File

@ -35,189 +35,190 @@ log = logging.getLogger(__name__)
class EventReceiver(QtCore.QObject):
"""
Class to allow events to be passed from different parts of the
system. This is a private class and should not be used directly
but rather via the Receiver class.
Class to allow events to be passed from different parts of the system. This
is a private class and should not be used directly but rather via the
Receiver class.
**Mainwindow related and generic signals**
``mainwindow_status_text``
Changes the bottom status bar text on the mainwindow.
``openlp_warning_message``
Displays a standalone Warning Message.
``openlp_error_message``
Displays a standalone Error Message.
``openlp_information_message``
Displays a standalone Information Message.
``cursor_busy``
Makes the cursor got to a busy form.
``cursor_normal``
Resets the cursor to default.
``openlp_process_events``
Requests the Application to flush the events queue
Requests the Application to flush the events queue.
``openlp_version_check``
Version has changed so pop up window.
``openlp_stop_wizard``
Stops a wizard before completion.
**Setting related signals**
``config_updated``
Informs components the config has changed
Informs components that the config has changed.
``config_screen_changed``
The display monitor has been changed
The display monitor has been changed.
**Slidecontroller signals**
``slidecontroller_{live|preview}_next``
Moves to the next slide
Moves to the next slide.
``slidecontroller_{live|preview}_next_noloop``
Moves to the next slide without auto advance
Moves to the next slide without auto advance.
``slidecontroller_{live|preview}_previous``
Moves to the previous slide
Moves to the previous slide.
``slidecontroller_{live|preview}_previous_noloop``
Moves to the previous slide, without auto advance
Moves to the previous slide, without auto advance.
``slidecontroller_{live|preview}_set``
Moves to a specific slide, by index
Moves to a specific slide, by index.
``slidecontroller_{live|preview}_started``
Broadcasts that an item has been made live/previewed
Broadcasts that an item has been made live/previewed.
``slidecontroller_{live|preview}_change``
Informs the slidecontroller that a slide change has occurred and to
update itself
update itself.
``slidecontroller_{live|preview}_changed``
Broadcasts that the slidecontroller has changed the current slide
Broadcasts that the slidecontroller has changed the current slide.
``slidecontroller_{live|preview}_blank``
Request that the output screen is blanked
Request that the output screen is blanked.
``slidecontroller_{live|preview}_unblank``
Request that the output screen is unblanked
Request that the output screen is unblanked.
``slidecontroller_live_spin_delay``
Pushes out the loop delay
Pushes out the loop delay.
``slidecontroller_live_stop_loop``
Stop the loop on the main display
Stop the loop on the main display.
**Servicemanager related signals**
``servicemanager_previous_item``
Display the previous item in the service
Display the previous item in the service.
``servicemanager_preview_live``
Requests a Preview item from the Service Manager to update live and
add a new item to the preview panel
Requests a Preview item from the Service Manager to update live and add
a new item to the preview panel.
``servicemanager_next_item``
Display the next item in the service
Display the next item in the service.
``servicemanager_set_item``
Go live on a specific item, by index
``maindisplay_blank``
Blank the maindisplay window
``maindisplay_hide``
Hide the maindisplay window
``maindisplay_show``
Return the maindisplay window
``maindisplay_active``
The maindisplay has been made active
``maindisplay_status_text``
Changes the bottom status bar text on the maindisplay window
``maindisplay_blank_check``
Check to see if the blank display message is required
``videodisplay_start``
Open a media item and prepare for playing
``videodisplay_play``
Start playing a media item
``videodisplay_pause``
Pause a media item
``videodisplay_stop``
Stop playing a media item
``videodisplay_background``
Replace the background video
``theme_update_list``
send out message with new themes
``theme_update_global``
Tell the components we have a new global theme
``{plugin}_start``
Requests a plugin to start a external program
Path and file provided in message
``{plugin}_first``
Requests a plugin to handle a first event
``{plugin}_previous``
Requests a plugin to handle a previous event
``{plugin}_next``
Requests a plugin to handle a next event
``{plugin}_last``
Requests a plugin to handle a last event
``{plugin}_slide``
Requests a plugin to handle a go to specific slide event
``{plugin}_stop``
Requests a plugin to handle a stop event
``{plugin}_blank``
Requests a plugin to handle a blank screen event
``{plugin}_unblank``
Requests a plugin to handle an unblank screen event
``{plugin}_edit``
Requests a plugin edit a database item with the key as the payload
``{plugin}_edit_clear``
Editing has been completed
``{plugin}_load_list``
Tells the the plugin to reload the media manager list
``{plugin}_preview``
Tells the plugin it's item can be previewed
``{plugin}_add_service_item``
Ask the plugin to push the selected items to the service item
``{plugin}_service_load``
Ask the plugin to process an individual service item after it has been
loaded
Go live on a specific item, by index.
``service_item_update``
Passes back to the service manager the service item after it has been
processed by the plugin
processed by the plugin.
**Display signals**
``update_display_css``
CSS has been updated which needs to be changed on the main display.
**Live Display signals**
``live_display_hide``
Hide the live display.
``live_display_show``
Return the live display.
``live_display_active``
The live display has been made active.
``live_display_blank_check``
Check to see if the blank display message is required.
**Theme related singlas**
``theme_update_list``
send out message with new themes.
``theme_update_global``
Tell the components we have a new global theme.
**Plugin specific signals**
``{plugin}_start``
Requests a plugin to start a external program. Path and file have to
be provided in the message.
``{plugin}_first``
Requests a plugin to handle a first event.
``{plugin}_previous``
Requests a plugin to handle a previous event.
``{plugin}_next``
Requests a plugin to handle a next event.
``{plugin}_last``
Requests a plugin to handle a last event.
``{plugin}_slide``
Requests a plugin to handle a go to specific slide event.
``{plugin}_stop``
Requests a plugin to handle a stop event.
``{plugin}_blank``
Requests a plugin to handle a blank screen event.
``{plugin}_unblank``
Requests a plugin to handle an unblank screen event.
``{plugin}_edit``
Requests a plugin edit a database item with the key as the payload.
``{plugin}_edit_clear``
Editing has been completed.
``{plugin}_load_list``
Tells the the plugin to reload the media manager list.
``{plugin}_preview``
Tells the plugin it's item can be previewed.
``{plugin}_add_service_item``
Ask the plugin to push the selected items to the service item.
``{plugin}_service_load``
Ask the plugin to process an individual service item after it has been
loaded.
``alerts_text``
Displays an alert message
Displays an alert message.
``bibles_nobook``
Attempt to find book resulted in no match
``openlp_stop_wizard``
Stops a wizard before completion
Attempt to find book resulted in no match.
``remotes_poll_request``
Waits for openlp to do something "interesting" and sends a
remotes_poll_response signal when it does
``openlp_warning_message``
Displays a standalone Warning Message
``openlp_error_message``
Displays a standalone Error Message
``openlp_information_message``
Displays a standalone Information Message
``cursor_busy``
Makes the cursor got to a busy form
``cursor_normal``
Resets the cursor to default
``remotes_poll_response`` signal when it does.
"""
def __init__(self):

View File

@ -73,13 +73,7 @@ body {
#video2 {
z-index: 3;
}
#alert {
position: absolute;
left: 0px;
top: 0px;
z-index: 10;
%s
}
%s
#footer {
position: absolute;
z-index: 6;
@ -179,7 +173,7 @@ sup {
break;
}
}
%s
function show_image(src){
var img = document.getElementById('image');
img.src = src;
@ -225,34 +219,6 @@ sup {
}
}
function show_alert(alerttext, position){
var text = document.getElementById('alert');
text.innerHTML = alerttext;
if(alerttext == '') {
text.style.visibility = 'hidden';
return 0;
}
if(position == ''){
position = getComputedStyle(text, '').verticalAlign;
}
switch(position)
{
case 'top':
text.style.top = '0px';
break;
case 'middle':
text.style.top = ((window.innerHeight - text.clientHeight) / 2)
+ 'px';
break;
case 'bottom':
text.style.top = (window.innerHeight - text.clientHeight)
+ 'px';
break;
}
text.style.visibility = 'visible';
return text.clientHeight;
}
function show_footer(footertext){
document.getElementById('footer').innerHTML = footertext;
}
@ -316,14 +282,15 @@ sup {
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
</video>
%s
%s
<div id="footer" class="footer"></div>
<div id="black" class="size"></div>
<div id="alert" style="visibility:hidden"></div>
</body>
</html>
"""
def build_html(item, screen, alert, islive, background, image=None):
def build_html(item, screen, islive, background, image=None,
plugins=None):
"""
Build the full web paged structure for display
@ -333,9 +300,6 @@ def build_html(item, screen, alert, islive, background, image=None):
``screen``
Current display information
``alert``
Alert display display information
``islive``
Item is going live, rather than preview/theme building
@ -344,6 +308,9 @@ def build_html(item, screen, alert, islive, background, image=None):
``image``
Image media item - bytes
``plugins``
The List of available plugins
"""
width = screen[u'size'].width()
height = screen[u'size'].height()
@ -360,14 +327,24 @@ def build_html(item, screen, alert, islive, background, image=None):
image_src = u'src="data:image/png;base64,%s"' % image
else:
image_src = u'style="display:none;"'
css_additions = u''
js_additions = u''
html_additions = u''
if plugins:
for plugin in plugins:
css_additions += plugin.getDisplayCss()
js_additions += plugin.getDisplayJavaScript()
html_additions += plugin.getDisplayHtml()
html = HTMLSRC % (build_background_css(item, width, height),
width, height,
build_alert_css(alert, width),
css_additions,
build_footer_css(item, height),
build_lyrics_css(item, webkitvers),
u'true' if theme and theme.display_slide_transition and islive \
else u'false',
js_additions,
bgimage_src, image_src,
html_additions,
build_lyrics_html(item, webkitvers))
return html

View File

@ -369,3 +369,30 @@ class Plugin(QtCore.QObject):
"""
self.textStrings[name] = {u'title': title, u'tooltip': tooltip}
def getDisplayCss(self):
"""
Add css style sheets to htmlbuilder.
"""
return u''
def getDisplayJavaScript(self):
"""
Add javascript functions to htmlbuilder.
"""
return u''
def refreshCss(self, frame):
"""
Allow plugins to refresh javascript on displayed screen.
``frame``
The Web frame holding the page.
"""
return u''
def getDisplayHtml(self):
"""
Add html code to htmlbuilder.
"""
return u''

View File

@ -42,6 +42,13 @@ class PluginManager(object):
"""
log.info(u'Plugin manager loaded')
@staticmethod
def get_instance():
"""
Obtain a single instance of class.
"""
return PluginManager.instance
def __init__(self, plugin_dir):
"""
The constructor for the plugin manager. Passes the controllers on to
@ -51,6 +58,7 @@ class PluginManager(object):
The directory to search for plugins.
"""
log.info(u'Plugin manager Initialising')
PluginManager.instance = self
if not plugin_dir in sys.path:
log.debug(u'Inserting %s into sys.path', plugin_dir)
sys.path.insert(0, plugin_dir)

View File

@ -57,14 +57,14 @@ class Renderer(object):
def __init__(self, imageManager, themeManager):
"""
Initialise the render manager.
Initialise the renderer.
``imageManager``
A ImageManager instance which takes care of e. g. caching and resizing
A imageManager instance which takes care of e. g. caching and resizing
images.
``themeManager``
The ThemeManager instance, used to get the current theme details.
The themeManager instance, used to get the current theme details.
"""
log.debug(u'Initialisation started')
self.themeManager = themeManager
@ -81,7 +81,7 @@ class Renderer(object):
def update_display(self):
"""
Updates the render manager's information about the current screen.
Updates the renderer's information about the current screen.
"""
log.debug(u'Update Display')
self._calculate_default()

View File

@ -122,9 +122,8 @@ class ServiceItem(object):
def _new_item(self):
"""
Method to set the internal id of the item
This is used to compare service items to see if they are
the same
Method to set the internal id of the item. This is used to compare
service items to see if they are the same.
"""
self._uuid = unicode(uuid.uuid1())
@ -160,9 +159,8 @@ class ServiceItem(object):
def render(self, use_override=False):
"""
The render method is what generates the frames for the screen and
obtains the display information from the renderemanager.
At this point all the slides are built for the given
display size.
obtains the display information from the renderer. At this point all
slides are built for the given display size.
"""
log.debug(u'Render called')
self._display_frames = []

View File

@ -178,6 +178,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
'Please add the information that bug reports are favoured written '
'in English.'))
content = self._createReport()
source = u''
exception = u''
for line in content[2].split(u'\n'):
if re.search(r'[/\\]openlp[/\\]', line):
source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line)

View File

@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
translate
translate, PluginManager
from openlp.core.ui import HideMode, ScreenList
@ -51,12 +51,15 @@ class MainDisplay(QtGui.QGraphicsView):
def __init__(self, parent, imageManager, live):
if live:
QtGui.QGraphicsView.__init__(self)
# Do not overwrite the parent() method.
self.parent = lambda: parent
else:
QtGui.QGraphicsView.__init__(self, parent)
self.isLive = live
self.imageManager = imageManager
self.screens = ScreenList.get_instance()
self.alertTab = None
self.plugins = PluginManager.get_instance().plugins
self.rebuildCSS = False
self.hideMode = None
self.videoHide = False
self.override = {}
@ -74,12 +77,32 @@ class MainDisplay(QtGui.QGraphicsView):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay)
QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
QtCore.SIGNAL(u'live_display_show'), self.showDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_phonon_creation'),
self.createMediaObject)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'update_display_css'), self.cssChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configChanged)
def cssChanged(self):
"""
We may need to rebuild the CSS on the live display.
"""
self.rebuildCSS = True
def configChanged(self):
"""
Call the plugins to rebuild the Live display CSS as the screen has
not been rebuild on exit of config.
"""
if self.rebuildCSS and self.plugins:
for plugin in self.plugins:
plugin.refreshCss(self.frame)
self.rebuildCSS = False
def retranslateUi(self):
"""
@ -111,6 +134,9 @@ class MainDisplay(QtGui.QGraphicsView):
self.screen[u'size'].width(), self.screen[u'size'].height())
self.page = self.webView.page()
self.frame = self.page.mainFrame()
if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
self.webView.settings().setAttribute(
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
QtCore.QObject.connect(self.webView,
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
@ -120,14 +146,6 @@ class MainDisplay(QtGui.QGraphicsView):
self.frame.setScrollBarPolicy(QtCore.Qt.Horizontal,
QtCore.Qt.ScrollBarAlwaysOff)
if self.isLive:
# Build the initial frame.
self.black = QtGui.QImage(
self.screen[u'size'].width(),
self.screen[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
painter_image = QtGui.QPainter()
painter_image.begin(self.black)
painter_image.fillRect(self.black.rect(), QtCore.Qt.black)
# Build the initial frame.
image_file = QtCore.QSettings().value(u'advanced/default image',
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
@ -153,7 +171,7 @@ class MainDisplay(QtGui.QGraphicsView):
serviceItem = ServiceItem()
serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
self.webView.setHtml(build_html(serviceItem, self.screen,
self.alertTab, self.isLive, None))
self.isLive, None))
self.__hideMouse()
# To display or not to display?
if not self.screen[u'primary']:
@ -184,7 +202,7 @@ class MainDisplay(QtGui.QGraphicsView):
"""
Add the slide text from slideController
`slide`
``slide``
The slide text to be displayed
"""
log.debug(u'text to display')
@ -197,20 +215,22 @@ class MainDisplay(QtGui.QGraphicsView):
def alert(self, text):
"""
Add the alert text
Display an alert.
`slide`
The slide text to be displayed
``text``
The text to be displayed.
"""
log.debug(u'alert to display')
if self.height() != self.screen[u'size'].height() or not \
self.isVisible() or self.videoWidget.isVisible():
shrink = True
js = u'show_alert("%s", "%s")' % (
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'),
u'top')
else:
shrink = False
js = u'show_alert("%s", "%s")' % (
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'),
u'top' if shrink else u'')
js = u'show_alert("%s", "")' % (
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
height = self.frame.evaluateJavaScript(js)
if shrink:
if self.phononActive:
@ -233,13 +253,16 @@ class MainDisplay(QtGui.QGraphicsView):
def directImage(self, name, path, background):
"""
API for replacement backgrounds so Images are added directly to cache
API for replacement backgrounds so Images are added directly to cache.
"""
self.imageManager.add_image(name, path, u'image', background)
if hasattr(self, u'serviceItem'):
self.override[u'image'] = name
self.override[u'theme'] = self.serviceItem.themedata.theme_name
self.image(name)
# Update the preview frame.
if self.isLive:
self.parent().updatePreview()
return True
return False
@ -248,8 +271,8 @@ class MainDisplay(QtGui.QGraphicsView):
Add an image as the background. The image has already been added
to the cache.
`Image`
The name of the image to be displayed
``Image``
The name of the image to be displayed.
"""
log.debug(u'image to display')
image = self.imageManager.get_image_bytes(name)
@ -266,14 +289,11 @@ class MainDisplay(QtGui.QGraphicsView):
else:
js = u'show_image("");'
self.frame.evaluateJavaScript(js)
# Update the preview frame.
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def resetImage(self):
"""
Reset the backgound image to the service item image.
Used after Image plugin has changed the background
Reset the backgound image to the service item image. Used after the
image plugin has changed the background.
"""
log.debug(u'resetImage')
if hasattr(self, u'serviceItem'):
@ -282,9 +302,6 @@ class MainDisplay(QtGui.QGraphicsView):
self.displayImage(None)
# clear the cache
self.override = {}
# Update the preview frame.
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def resetVideo(self):
"""
@ -300,9 +317,6 @@ class MainDisplay(QtGui.QGraphicsView):
else:
self.frame.evaluateJavaScript(u'show_video("close");')
self.override = {}
# Update the preview frame.
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def videoPlay(self):
"""
@ -355,7 +369,7 @@ class MainDisplay(QtGui.QGraphicsView):
"""
# We request a background video but have no service Item
if isBackground and not hasattr(self, u'serviceItem'):
return None
return False
if not self.mediaObject:
self.createMediaObject()
log.debug(u'video')
@ -382,9 +396,7 @@ class MainDisplay(QtGui.QGraphicsView):
self.webView.setVisible(False)
self.videoWidget.setVisible(True)
self.audio.setVolume(vol)
# Update the preview frame.
if self.isLive:
Receiver.send_message(u'maindisplay_active')
return True
def videoState(self, newState, oldState):
"""
@ -491,8 +503,8 @@ class MainDisplay(QtGui.QGraphicsView):
image_bytes = self.imageManager.get_image_bytes(image)
else:
image_bytes = None
html = build_html(self.serviceItem, self.screen, self.alertTab,
self.isLive, background, image_bytes)
html = build_html(self.serviceItem, self.screen, self.isLive,
background, image_bytes, self.plugins)
log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml')
@ -558,7 +570,7 @@ class MainDisplay(QtGui.QGraphicsView):
self.hideMode = None
# Trigger actions when display is active again
if self.isLive:
Receiver.send_message(u'maindisplay_active')
Receiver.send_message(u'live_display_active')
def __hideMouse(self):
# Hide mouse cursor when moved over display if enabled in settings

View File

@ -611,11 +611,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_version_check'), self.versionNotice)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_blank_check'), self.blankCheck)
QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
QtCore.SIGNAL(u'mainwindow_status_text'), self.showStatusMessage)
# Media Manager
QtCore.QObject.connect(self.mediaToolBox,
QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)

View File

@ -58,7 +58,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
# load all the settings
self.settingListWidget.clear()
for tabIndex in range(0, self.stackedLayout.count() + 1):
# take at 0 and the rest shuffell up.
# take at 0 and the rest shuffle up.
self.stackedLayout.takeAt(0)
self.insertTab(self.generalTab, 0, PluginStatus.Active)
self.insertTab(self.themesTab, 1, PluginStatus.Active)

View File

@ -79,7 +79,6 @@ class SlideController(QtGui.QWidget):
self.songEdit = False
self.selectedRow = 0
self.serviceItem = None
self.alertTab = None
self.panel = QtGui.QWidget(parent.controlSplitter)
self.slideList = {}
# Layout for holding panel
@ -423,7 +422,6 @@ class SlideController(QtGui.QWidget):
if self.display:
self.display.close()
self.display = MainDisplay(self, self.imageManager, self.isLive)
self.display.alertTab = self.alertTab
self.display.setup()
if self.isLive:
self.__addActionsToWidget(self.display)
@ -745,9 +743,9 @@ class SlideController(QtGui.QWidget):
elif display_type == u'blanked':
self.onBlankDisplay(True)
else:
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'live_display_show')
else:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'live_display_hide', HideMode.Screen)
def onSlideBlank(self):
"""
@ -833,21 +831,21 @@ class SlideController(QtGui.QWidget):
if self.serviceItem is not None:
if hide_mode:
if not self.serviceItem.is_command():
Receiver.send_message(u'maindisplay_hide', hide_mode)
Receiver.send_message(u'live_display_hide', hide_mode)
Receiver.send_message(u'%s_blank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, hide_mode])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'live_display_show')
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if hide_mode:
Receiver.send_message(u'maindisplay_hide', hide_mode)
Receiver.send_message(u'live_display_hide', hide_mode)
else:
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'live_display_show')
def hidePlugin(self, hide):
"""
@ -856,21 +854,21 @@ class SlideController(QtGui.QWidget):
log.debug(u'hidePlugin %s ', hide)
if self.serviceItem is not None:
if hide:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'live_display_hide', HideMode.Screen)
Receiver.send_message(u'%s_hide'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if not self.serviceItem.is_command():
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'live_display_show')
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
if hide:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'live_display_hide', HideMode.Screen)
else:
Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'live_display_show')
def onSlideSelected(self, start=False):
"""

View File

@ -32,6 +32,7 @@ from PyQt4 import QtCore
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.core.lib.ui import icon_action, UiStrings
from openlp.core.lib.theme import VerticalType
from openlp.core.utils.actions import ActionList
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema
@ -39,6 +40,63 @@ from openlp.plugins.alerts.forms import AlertForm
log = logging.getLogger(__name__)
JAVASCRIPT = """
function show_alert(alerttext, position){
var text = document.getElementById('alert');
text.innerHTML = alerttext;
if(alerttext == '') {
text.style.visibility = 'hidden';
return 0;
}
if(position == ''){
position = getComputedStyle(text, '').verticalAlign;
}
switch(position)
{
case 'top':
text.style.top = '0px';
break;
case 'middle':
text.style.top = ((window.innerHeight - text.clientHeight) / 2)
+ 'px';
break;
case 'bottom':
text.style.top = (window.innerHeight - text.clientHeight)
+ 'px';
break;
}
text.style.visibility = 'visible';
return text.clientHeight;
}
function update_css(align, font, size, color, bgcolor){
var text = document.getElementById('alert');
text.style.verticalAlign = align;
text.style.fontSize = size + "pt";
text.style.fontFamily = font;
text.style.color = color;
text.style.backgroundColor = bgcolor;
}
"""
CSS = """
#alert {
position: absolute;
left: 0px;
top: 0px;
z-index: 10;
width: 100%%;
vertical-align: %s;
font-family: %s;
font-size: %spt;
color: %s;
background-color: %s;
}
"""
HTML = """
<div id="alert" style="visibility:hidden"></div>
"""
class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded')
@ -79,7 +137,6 @@ class AlertsPlugin(Plugin):
self.toolsAlertItem.setVisible(True)
action_list = ActionList.get_instance()
action_list.add_action(self.toolsAlertItem, UiStrings().Tools)
self.liveController.alertTab = self.settings_tab
def finalise(self):
"""
@ -121,3 +178,35 @@ class AlertsPlugin(Plugin):
u'title': translate('AlertsPlugin', 'Alerts', 'container title')
}
def getDisplayJavaScript(self):
"""
Add Javascript to the main display.
"""
return JAVASCRIPT
def getDisplayCss(self):
"""
Add CSS to the main display.
"""
align = VerticalType.Names[self.settings_tab.location]
return CSS % (align, self.settings_tab.font_face,
self.settings_tab.font_size, self.settings_tab.font_color,
self.settings_tab.bg_color)
def getDisplayHtml(self):
"""
Add HTML to the main display.
"""
return HTML
def refreshCss(self, frame):
"""
Trigger an update of the CSS in the maindisplay.
``frame``
The Web frame holding the page.
"""
align = VerticalType.Names[self.settings_tab.location]
frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
(align, self.settings_tab.font_face, self.settings_tab.font_size,
self.settings_tab.font_color, self.settings_tab.bg_color))

View File

@ -45,7 +45,7 @@ class AlertsManager(QtCore.QObject):
self.timer_id = 0
self.alertList = []
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_active'), self.generateAlert)
QtCore.SIGNAL(u'live_display_active'), self.generateAlert)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'alerts_text'), self.onAlertText)
@ -69,11 +69,11 @@ class AlertsManager(QtCore.QObject):
log.debug(u'display alert called %s' % text)
self.alertList.append(text)
if self.timer_id != 0:
Receiver.send_message(u'maindisplay_status_text',
Receiver.send_message(u'mainwindow_status_text',
translate('AlertsPlugin.AlertsManager',
'Alert message created and displayed.'))
return
Receiver.send_message(u'maindisplay_status_text', u'')
Receiver.send_message(u'mainwindow_status_text', u'')
self.generateAlert()
def generateAlert(self):
@ -81,7 +81,7 @@ class AlertsManager(QtCore.QObject):
Format and request the Alert and start the timer
"""
log.debug(u'Generate Alert called')
if len(self.alertList) == 0:
if not self.alertList:
return
text = self.alertList.pop(0)
alertTab = self.parent().settings_tab

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate
from openlp.core.lib import SettingsTab, translate, Receiver
from openlp.core.lib.ui import UiStrings, create_valign_combo
class AlertsTab(SettingsTab):
@ -140,6 +140,7 @@ class AlertsTab(SettingsTab):
def onTimeoutSpinBoxChanged(self):
self.timeout = self.timeoutSpinBox.value()
self.changed = True
def onFontSizeSpinBoxChanged(self):
self.font_size = self.fontSizeSpinBox.value()
@ -171,10 +172,15 @@ class AlertsTab(SettingsTab):
font.setFamily(self.font_face)
self.fontComboBox.setCurrentFont(font)
self.updateDisplay()
self.changed = False
def save(self):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
# Check value has changed as no event handles this field
if settings.value(u'location', QtCore.QVariant(1)).toInt()[0] != \
self.verticalComboBox.currentIndex():
self.changed = True
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
settings.setValue(u'font color', QtCore.QVariant(self.font_color))
settings.setValue(u'font size', QtCore.QVariant(self.font_size))
@ -184,6 +190,9 @@ class AlertsTab(SettingsTab):
self.location = self.verticalComboBox.currentIndex()
settings.setValue(u'location', QtCore.QVariant(self.location))
settings.endGroup()
if self.changed:
Receiver.send_message(u'update_display_css')
self.changed = False
def updateDisplay(self):
font = QtGui.QFont()
@ -193,4 +202,5 @@ class AlertsTab(SettingsTab):
self.fontPreview.setFont(font)
self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' %
(self.bg_color, self.font_color))
self.changed = True

View File

@ -39,7 +39,7 @@ from openlp.core.lib.ui import UiStrings, critical_error_message_box
log = logging.getLogger(__name__)
CLAPPERBOARD = QtGui.QPixmap(u':/media/media_video.png').toImage()
CLAPPERBOARD = QtGui.QImage(u':/media/media_video.png')
class MediaMediaItem(MediaManagerItem):
"""
@ -95,14 +95,14 @@ class MediaMediaItem(MediaManagerItem):
def onResetClick(self):
"""
Called to reset the Live backgound with the media selected,
Called to reset the Live backgound with the media selected.
"""
self.resetAction.setVisible(False)
self.plugin.liveController.display.resetVideo()
def videobackgroundReplaced(self):
"""
Triggered by main display on change of serviceitem
Triggered by main display on change of serviceitem.
"""
self.resetAction.setVisible(False)
@ -179,8 +179,7 @@ class MediaMediaItem(MediaManagerItem):
def mediaStateWait(self, mediaState):
"""
Wait for the video to change its state
Wait no longer than 5 seconds.
Wait for the video to change its state. Wait no longer than 5 seconds.
"""
start = datetime.now()
while self.mediaObject.state() != mediaState:
@ -198,7 +197,7 @@ class MediaMediaItem(MediaManagerItem):
def onDeleteClick(self):
"""
Remove a media item from the list
Remove a media item from the list.
"""
if check_item_selected(self.listView, translate('MediaPlugin.MediaItem',
'You must select a media file to delete.')):

View File

@ -68,7 +68,7 @@ class Controller(object):
self.doc.slidenumber = slide_no
if self.is_live:
if hide_mode == HideMode.Screen:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'live_display_hide', HideMode.Screen)
self.stop()
elif hide_mode == HideMode.Theme:
self.blank(hide_mode)
@ -76,7 +76,7 @@ class Controller(object):
self.blank(hide_mode)
else:
self.doc.start_presentation()
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'live_display_hide', HideMode.Screen)
self.doc.slidenumber = 0
if slide_no > 1:
self.slide(slide_no)
@ -196,7 +196,7 @@ class Controller(object):
if not self.doc.is_active():
return
if hide_mode == HideMode.Theme:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
Receiver.send_message(u'live_display_hide', HideMode.Theme)
self.doc.blank_screen()
def stop(self):
@ -224,7 +224,7 @@ class Controller(object):
self.doc.slidenumber != self.doc.get_slide_number():
self.doc.goto_slide(self.doc.slidenumber)
self.doc.unblank_screen()
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'live_display_hide', HideMode.Screen)
def poll(self):
self.doc.poll_slidenumber(self.is_live)

View File

@ -258,7 +258,7 @@ class EasiSlidesImport(SongImport):
verses[reg][vt][vn] = {}
if not verses[reg][vt][vn].has_key(inst):
verses[reg][vt][vn][inst] = []
words = self.tidy_text(line)
words = self.tidyText(line)
verses[reg][vt][vn][inst].append(words)
# done parsing

View File

@ -194,7 +194,7 @@ class SofImport(OooImport):
into line
"""
text = textportion.getString()
text = self.tidy_text(text)
text = self.tidyText(text)
if text.strip() == u'':
return text
if textportion.CharWeight == BOLD:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -65,8 +65,11 @@ Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription
[Files]
Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: psvince.dll; Flags: dontcopy
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
; DLL used to check if the target program is running at install time
Source: psvince.dll; flags: dontcopy
; psvince is installed in {app} folder, so it will be loaded at
; uninstall time to check if the target program is running
Source: psvince.dll; DestDir: {app}
[Icons]
Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
@ -87,8 +90,13 @@ Root: HKCR; Subkey: "OpenLP\DefaultIcon"; ValueType: string; ValueName: ""; Valu
Root: HKCR; Subkey: "OpenLP\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\OpenLP.exe"" ""%1"""
[Code]
function IsModuleLoaded(modulename: AnsiString ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';
// Function to call psvince.dll at install time
function IsModuleLoadedInstall(modulename: AnsiString ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';
// Function to call psvince.dll at uninstall time
function IsModuleLoadedUninstall(modulename: AnsiString ): Boolean;
external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly' ;
function GetUninstallString(): String;
var
@ -133,7 +141,7 @@ end;
function InitializeSetup(): Boolean;
begin
Result := true;
while IsModuleLoaded( 'OpenLP.exe' ) and Result do
while IsModuleLoadedInstall( 'OpenLP.exe' ) and Result do
begin
if MsgBox( 'Openlp is currently running, please close it to continue the install.',
mbError, MB_OKCANCEL ) = IDCANCEL then
@ -153,3 +161,16 @@ begin
end;
end;
end;
function InitializeUninstall(): Boolean;
begin
Result := true;
while IsModuleLoadedUninstall( 'OpenLP.exe' ) and Result do
begin
if MsgBox( 'Openlp is currently running, please close it to continue the uninstall.',
mbError, MB_OKCANCEL ) = IDCANCEL then
begin
Result := false;
end;
end;
end;