diff urwid_satext/sat_widgets.py @ 77:e1655ba45fae

MenuRoller doesn't propagate key pressed anymore if it manage a 'up' or 'down' event
author Goffi <goffi@goffi.org>
date Fri, 21 Mar 2014 15:35:10 +0100
parents 6c2a1b349416
children 56c02f4731f9
line wrap: on
line diff
--- a/urwid_satext/sat_widgets.py	Fri Mar 21 15:21:02 2014 +0100
+++ b/urwid_satext/sat_widgets.py	Fri Mar 21 15:35:10 2014 +0100
@@ -794,7 +794,7 @@
             name,menu = menu_tuple
             self.addMenu(name, menu)
 
-    def __showSelected(self):
+    def _showSelected(self):
         """show menu selected"""
         name_txt = u'\u21c9 '+self.name_list[self.selected]+u' \u21c7 '
         current_name = ClickableText(name_txt)
@@ -808,11 +808,13 @@
         if key=='up':
             if self.columns.get_focus_column()==0 and self.selected > 0:
                 self.selected -= 1
-                self.__showSelected()
+                self._showSelected()
+                return
         elif key=='down':
             if self.columns.get_focus_column()==0 and self.selected < len(self.name_list)-1:
                 self.selected += 1
-                self.__showSelected()
+                self._showSelected()
+                return
         elif key=='right':
             if self.columns.get_focus_column()==0 and \
                 (isinstance(self.columns.contents[1][0], urwid.Text) or \
@@ -827,7 +829,7 @@
             self.name_list.append(name)
         self.menus[name] = menu
         if self.name_list[self.selected] == name:
-            self.__showSelected() #if we are on the menu, we update it
+            self._showSelected() #if we are on the menu, we update it
 
     def removeMenu(self, name):
         if name in self.name_list:
@@ -835,7 +837,7 @@
         if name in self.menus.keys():
             del self.menus[name]
         self.selected = 0
-        self.__showSelected()
+        self._showSelected()
 
     def checkShortcuts(self, key):
         for menu in self.name_list: