4 notificationAdded = [ ]
6 # notifications which are currently on screen (and might be closed by similiar notifications)
7 current_notifications = [ ]
9 def __AddNotification(fnc, screen, id, *args, **kwargs):
10 notifications.append((fnc, screen, args, kwargs, id))
11 for x in notificationAdded:
14 def AddNotification(screen, *args, **kwargs):
15 AddNotificationWithCallback(None, screen, *args, **kwargs)
17 def AddNotificationWithCallback(fnc, screen, *args, **kwargs):
18 __AddNotification(fnc, screen, None, *args, **kwargs)
20 def AddNotificationWithID(id, screen, *args, **kwargs):
21 __AddNotification(None, screen, id, *args, **kwargs)
23 # we don't support notifications with callback and ID as this
24 # would require manually calling the callback on cancelled popups.
27 # remove similiar notifications
28 print "RemovePopup, id =", id
29 for x in notifications:
30 if x[4] and x[4] == id:
31 print "(found in notifications)"
32 notifications.remove(x)
34 for x in current_notifications:
36 print "(found in current notifications)"
39 from Screens.MessageBox import MessageBox
41 def AddPopup(text, type, timeout, id = None):
44 print "AddPopup, id =", id
45 AddNotificationWithID(id, MessageBox, text = text, type = type, timeout = timeout, close_on_any_key = True)