# HG changeset patch # User Goffi # Date 1279291018 -28800 # Node ID e7b8871e9f52cb5d1edd05152bacab9e53d191be # Parent 2f8c86488b0550f83ad114f85ed7457289b9622a Primitivus: menu roller doesn't go anymore on a menu if it's empty diff -r 2f8c86488b05 -r e7b8871e9f52 frontends/primitivus/custom_widgets.py --- 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)