changeset 139:e7b8871e9f52

Primitivus: menu roller doesn't go anymore on a menu if it's empty
author Goffi <goffi@goffi.org>
date Fri, 16 Jul 2010 22:36:58 +0800
parents 2f8c86488b05
children e496134ed679
files frontends/primitivus/custom_widgets.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/primitivus/custom_widgets.py	Fri Jul 16 22:22:52 2010 +0800
+++ b/frontends/primitivus/custom_widgets.py	Fri Jul 16 22:36:58 2010 +0800
@@ -390,6 +390,10 @@
 
     def selectable(self):
         return True
+
+    def getMenuSize(self):
+        """return the current number of categories in this menu"""
+        return len(self.menu_keys)
    
     def setOrigX(self, orig_x):
         self.x_orig = orig_x
@@ -515,6 +519,11 @@
             if self.columns.get_focus_column()==0 and self.selected < len(self.name_list)-1:
                 self.selected += 1
                 self.__showSelected()
+        elif key=='right':
+            if self.columns.get_focus_column()==0 and \
+                (self.columns.widget_list[1].__class__ == urwid.Text or \
+                self.menus[self.name_list[self.selected]].getMenuSize()==0):
+                return #if we have no menu or the menu is empty, we don't go the right column
 
         return super(MenuRoller, self).keypress(size, key)