forked from openlp/openlp
- clean ups
- only display alert when the screen is not hidden
This commit is contained in:
parent
658e8f234b
commit
76f47a4f62
@ -186,7 +186,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')
|
||||
@ -199,20 +199,25 @@ class MainDisplay(QtGui.QGraphicsView):
|
||||
|
||||
def alert(self, text):
|
||||
"""
|
||||
Add the alert text
|
||||
Add the alert text. If the alert was not displayed, because the screen
|
||||
is not visible ``False`` is returned, otherwise ``True``.
|
||||
|
||||
`slide`
|
||||
The slide text to be displayed
|
||||
``slide``
|
||||
The slide 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():
|
||||
if not self.isVisible():
|
||||
return False
|
||||
if self.height() != self.screen[u'size'].height() or \
|
||||
self.videoWidget.isVisible():
|
||||
shrink = True
|
||||
else:
|
||||
shrink = False
|
||||
js = u'show_alert("%s", "%s")' % (
|
||||
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'),
|
||||
u'top' if shrink else u'')
|
||||
u'top')
|
||||
else:
|
||||
shrink = False
|
||||
js = u'show_alert("%s", "")' % (
|
||||
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||
height = self.frame.evaluateJavaScript(js)
|
||||
if shrink:
|
||||
if self.phononActive:
|
||||
@ -232,10 +237,11 @@ class MainDisplay(QtGui.QGraphicsView):
|
||||
else:
|
||||
shrinkItem.setVisible(False)
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
return True
|
||||
|
||||
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'):
|
||||
|
@ -85,7 +85,8 @@ class AlertsManager(QtCore.QObject):
|
||||
return
|
||||
text = self.alertList.pop(0)
|
||||
alertTab = self.parent().settings_tab
|
||||
self.parent().liveController.display.alert(text)
|
||||
if not self.parent().liveController.display.alert(text):
|
||||
self.alertList.insert(0, text)
|
||||
# Check to see if we have a timer running.
|
||||
if self.timer_id == 0:
|
||||
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
|
||||
|
Loading…
Reference in New Issue
Block a user