comparison urwid_satext/sat_widgets.py @ 65:090f3e0754d3

fix for recent urwid versions (> 1.1.0)
author Goffi <goffi@goffi.org>
date Mon, 25 Mar 2013 13:10:57 +0100
parents 5cef69971f23
children 287ff3e1edd1
comparison
equal deleted inserted replaced
64:5cef69971f23 65:090f3e0754d3
733 name_txt = u'\u21c9 '+self.name_list[self.selected]+u' \u21c7 ' 733 name_txt = u'\u21c9 '+self.name_list[self.selected]+u' \u21c7 '
734 current_name = ClickableText(name_txt) 734 current_name = ClickableText(name_txt)
735 name_len = len(name_txt) 735 name_len = len(name_txt)
736 current_menu = self.menus[self.name_list[self.selected]] 736 current_menu = self.menus[self.name_list[self.selected]]
737 current_menu.setOrigX(name_len) 737 current_menu.setOrigX(name_len)
738 self.columns.widget_list[0] = current_name 738 self.columns.contents[0] = (current_name, ('given', name_len, False))
739 self.columns.column_types[0]=('fixed', name_len) 739 self.columns.contents[1] = (current_menu, ('weight', 1, False))
740 self.columns.widget_list[1] = current_menu
741 740
742 def keypress(self, size, key): 741 def keypress(self, size, key):
743 if key=='up': 742 if key=='up':
744 if self.columns.get_focus_column()==0 and self.selected > 0: 743 if self.columns.get_focus_column()==0 and self.selected > 0:
745 self.selected -= 1 744 self.selected -= 1
748 if self.columns.get_focus_column()==0 and self.selected < len(self.name_list)-1: 747 if self.columns.get_focus_column()==0 and self.selected < len(self.name_list)-1:
749 self.selected += 1 748 self.selected += 1
750 self.__showSelected() 749 self.__showSelected()
751 elif key=='right': 750 elif key=='right':
752 if self.columns.get_focus_column()==0 and \ 751 if self.columns.get_focus_column()==0 and \
753 (isinstance(self.columns.widget_list[1], urwid.Text) or \ 752 (isinstance(self.columns.contents[1][0], urwid.Text) or \
754 self.menus[self.name_list[self.selected]].getMenuSize()==0): 753 self.menus[self.name_list[self.selected]].getMenuSize()==0):
755 return #if we have no menu or the menu is empty, we don't go the right column 754 return #if we have no menu or the menu is empty, we don't go the right column
756 755
757 return super(MenuRoller, self).keypress(size, key) 756 return super(MenuRoller, self).keypress(size, key)
758 757