4 notificationAdded = [ ]
7 # notifications which are currently on screen (and might be closed by similiar notifications)
8 current_notifications = [ ]
10 def __AddNotification(fnc, screen, id, *args, **kwargs):
11 notifications.append((fnc, screen, args, kwargs, id))
12 for x in notificationAdded:
15 def AddNotification(screen, *args, **kwargs):
16 AddNotificationWithCallback(None, screen, *args, **kwargs)
18 def AddNotificationWithCallback(fnc, screen, *args, **kwargs):
19 __AddNotification(fnc, screen, None, *args, **kwargs)
21 def AddNotificationWithID(id, screen, *args, **kwargs):
22 __AddNotification(None, screen, id, *args, **kwargs)
24 # we don't support notifications with callback and ID as this
25 # would require manually calling the callback on cancelled popups.
28 # remove similiar notifications
29 print "RemovePopup, id =", id
30 for x in notifications:
31 if x[4] and x[4] == id:
32 print "(found in notifications)"
33 notifications.remove(x)
35 for x in current_notifications:
37 print "(found in current notifications)"
40 def AddPopup(text, type, timeout, id = None):
43 from Screens.MessageBox import MessageBox
44 print "AddPopup, id =", id
45 AddNotificationWithID(id, MessageBox, text = text, type = type, timeout = timeout, close_on_any_key = True)