changeset 114:bf38c1c0db3b

notificationBar: added removePopUp to remove a widget in the queue
author Goffi <goffi@goffi.org>
date Wed, 11 Nov 2015 18:16:25 +0100
parents 77ccc1dd2261
children 2b7eafea8bdb
files urwid_satext/sat_widgets.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/urwid_satext/sat_widgets.py	Mon Nov 09 15:36:39 2015 +0100
+++ b/urwid_satext/sat_widgets.py	Wed Nov 11 18:16:25 2015 +0100
@@ -787,7 +787,7 @@
         urwid.WidgetWrap.__init__(self, urwid.AttrMap(self.columns,'notifs'))
         self.notifs = []
 
-    def __modQueue(self):
+    def _modQueue(self):
         """must be called each time the notifications queue is changed"""
         self.waitNotifs.set_text(('notifs',"(%i)" % len(self.notifs) if self.notifs else ''))
         self._emit('change')
@@ -805,7 +805,12 @@
     def addPopUp(self, pop_up_widget):
         """Add a popup to the waiting queue"""
         self.notifs.append(('popup',pop_up_widget))
-        self.__modQueue()
+        self._modQueue()
+
+    def removePopUp(self, pop_up_widget):
+        """Remove a popup from the waiting queue"""
+        self.notifs.remove(pop_up_widget)
+        self._modQueue()
 
     def addMessage(self, message):
         "Add a message to the notificatio bar"
@@ -815,7 +820,7 @@
             self._emit('change')
         else:
             self.notifs.append(('message',message))
-            self.__modQueue()
+            self._modQueue()
 
     def showNext(self):
         """Show next message if any, else delete current message"""
@@ -827,7 +832,7 @@
         if found:
             self.notifs.remove(found)
             self.message.set_text(('notifs',found[1]))
-            self.__modQueue()
+            self._modQueue()
             self.focus_possition = 1
         else:
             self.message.set_text('')
@@ -843,7 +848,7 @@
                 break
         if ret:
             self.notifs.remove(notif)
-            self.__modQueue()
+            self._modQueue()
         return ret
 
     def isQueueEmpty(self):