comparison frontends/primitivus/custom_widgets.py @ 13:8cccbaadb9c5

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 7e63429cc929
children f7d24eff1272
comparison
equal deleted inserted replaced
12:7e63429cc929 13:8cccbaadb9c5
388 self.focus_menu = 0 388 self.focus_menu = 0
389 self.save_bottom = None 389 self.save_bottom = None
390 390
391 def selectable(self): 391 def selectable(self):
392 return True 392 return True
393
394 def getMenuSize(self):
395 """return the current number of categories in this menu"""
396 return len(self.menu_keys)
393 397
394 def setOrigX(self, orig_x): 398 def setOrigX(self, orig_x):
395 self.x_orig = orig_x 399 self.x_orig = orig_x
396 400
397 def __buildOverlay(self,menu_key,columns): 401 def __buildOverlay(self,menu_key,columns):
513 self.__showSelected() 517 self.__showSelected()
514 elif key=='down': 518 elif key=='down':
515 if self.columns.get_focus_column()==0 and self.selected < len(self.name_list)-1: 519 if self.columns.get_focus_column()==0 and self.selected < len(self.name_list)-1:
516 self.selected += 1 520 self.selected += 1
517 self.__showSelected() 521 self.__showSelected()
522 elif key=='right':
523 if self.columns.get_focus_column()==0 and \
524 (self.columns.widget_list[1].__class__ == urwid.Text or \
525 self.menus[self.name_list[self.selected]].getMenuSize()==0):
526 return #if we have no menu or the menu is empty, we don't go the right column
518 527
519 return super(MenuRoller, self).keypress(size, key) 528 return super(MenuRoller, self).keypress(size, key)
520 529
521 def addMenu(self, name_param, menu): 530 def addMenu(self, name_param, menu):
522 name = name_param or '' 531 name = name_param or ''