- clean ups

- only display alert when the screen is not hidden
This commit is contained in:
Andreas Preikschat 2011-10-10 18:54:01 +02:00
parent 658e8f234b
commit 76f47a4f62
2 changed files with 18 additions and 11 deletions

View File

@ -186,7 +186,7 @@ class MainDisplay(QtGui.QGraphicsView):
""" """
Add the slide text from slideController Add the slide text from slideController
`slide` ``slide``
The slide text to be displayed The slide text to be displayed
""" """
log.debug(u'text to display') log.debug(u'text to display')
@ -199,20 +199,25 @@ class MainDisplay(QtGui.QGraphicsView):
def alert(self, text): 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` ``slide``
The slide text to be displayed The slide text to be displayed.
""" """
log.debug(u'alert to display') log.debug(u'alert to display')
if self.height() != self.screen[u'size'].height() or not \ if not self.isVisible():
self.isVisible() or self.videoWidget.isVisible(): return False
if self.height() != self.screen[u'size'].height() or \
self.videoWidget.isVisible():
shrink = True shrink = True
js = u'show_alert("%s", "%s")' % (
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'),
u'top')
else: else:
shrink = False shrink = False
js = u'show_alert("%s", "%s")' % ( js = u'show_alert("%s", "")' % (
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'), text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
u'top' if shrink else u'')
height = self.frame.evaluateJavaScript(js) height = self.frame.evaluateJavaScript(js)
if shrink: if shrink:
if self.phononActive: if self.phononActive:
@ -232,10 +237,11 @@ class MainDisplay(QtGui.QGraphicsView):
else: else:
shrinkItem.setVisible(False) shrinkItem.setVisible(False)
self.setGeometry(self.screen[u'size']) self.setGeometry(self.screen[u'size'])
return True
def directImage(self, name, path, background): 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) self.imageManager.add_image(name, path, u'image', background)
if hasattr(self, u'serviceItem'): if hasattr(self, u'serviceItem'):

View File

@ -85,7 +85,8 @@ class AlertsManager(QtCore.QObject):
return return
text = self.alertList.pop(0) text = self.alertList.pop(0)
alertTab = self.parent().settings_tab 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. # Check to see if we have a timer running.
if self.timer_id == 0: if self.timer_id == 0:
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000) self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)