Andreas Preikschat has proposed merging lp:~googol/openlp/bug-871441 into
lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Related bugs:
Bug #871441 in OpenLP: "Live Preview image is not updated when you "Replace
live background""
https://bugs.launchpad.net/openlp/+bug/871441
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-871441/+merge/79496
Hello,
1) Fixed bug 871441 (Live Preview image is not updated when you "Replace live
background")
The fix is in lines 8+9 and 87-89. I am not absolutely sure about line 9. (I do
not want to introduce bug 799549 again.) However, could not recreate the bug
myself, thus I cannot say whether my change introduces it again. Anyway, I
expect that overwriting the parent() method should not introduce it, rather the
initialisation makes the difference (see the merge proposal for the bug
mentioned above:
https://code.launchpad.net/~j-corwin/openlp/bug-799549/+merge/65259).
2) Removed dead code (lines 17-24)
3) Fixed docstrings
4) Only send the "maindisplay_active" signal when the main display is made
active (I do not know if that applies to you as well, but I was always confused
by this signal or at least I never felt that this signal were self-explanatory.
That is why I removed/replaced it (I missed to remove it in another proposal);
not the slide controllers take care or updating themselves.
However, the solution I prefer is, that we emit a signal (e. g.
maindisplay_changed). But it should not be emitted on a case by case basis (e.
g. in the text, alert, ... methods), rather by generic events (e. g. in the
isWebLoaded method). But the problem is, that we also have to emit the signal
when we evaluate Java Script.
5) Fixed alert display when maindisplay was closed.
Only start to display the alert when there is a main display. When there is no
maindisplay (closed with ESC) and you then display an alert the alert will be
shown, but the rest (background/image) will not be shown (trunk). Now the alert
will not be shown until the maindisplay is shown.
--
https://code.launchpad.net/~googol/openlp/bug-871441/+merge/79496
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2011-10-15 11:30:39 +0000
+++ openlp/core/ui/maindisplay.py 2011-10-16 15:32:26 +0000
@@ -51,6 +51,8 @@
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
@@ -121,14 +123,6 @@
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'))\
.toString()
@@ -184,7 +178,7 @@
"""
Add the slide text from slideController
- `slide`
+ ``slide``
The slide text to be displayed
"""
log.debug(u'text to display')
@@ -197,20 +191,22 @@
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 +229,16 @@
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 +247,8 @@
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 +265,11 @@
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 +278,6 @@
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 +293,6 @@
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):
"""
@@ -382,9 +372,6 @@
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):
=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py 2011-06-12 16:02:52 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py 2011-10-16 15:32:26 +0000
@@ -81,7 +81,7 @@
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
_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openlp-core
More help : https://help.launchpad.net/ListHelp