comparison urwid_satext/sat_widgets.py @ 67:c270867a80f9

updated deprecated FlowWidget use
author Goffi <goffi@goffi.org>
date Sat, 21 Dec 2013 16:55:52 +0100
parents 287ff3e1edd1
children 5c28bb50ae0d
comparison
equal deleted inserted replaced
66:287ff3e1edd1 67:c270867a80f9
158 if self._mode == 'NORMAL' and key in self._modes: 158 if self._mode == 'NORMAL' and key in self._modes:
159 self.mode = self._modes[key][0] 159 self.mode = self._modes[key][0]
160 return 160 return
161 return super(ModalEdit, self).keypress(size, key) 161 return super(ModalEdit, self).keypress(size, key)
162 162
163 class SurroundedText(urwid.FlowWidget): 163 class SurroundedText(urwid.Widget):
164 """Text centered on a repeated character (like a Divider, but with a text in the center)""" 164 """Text centered on a repeated character (like a Divider, but with a text in the center)"""
165 _sizing = frozenset(['flow'])
165 166
166 def __init__(self,text,car=utf8decode('─')): 167 def __init__(self,text,car=utf8decode('─')):
167 self.text=text 168 self.text=text
168 self.car=car 169 self.car=car
169 170
454 widget.setState(True) 455 widget.setState(True)
455 self.list_box.set_focus(idx) 456 self.list_box.set_focus(idx)
456 return 457 return
457 idx+=1 458 idx+=1
458 459
459 class List(urwid.FlowWidget): 460 class List(urwid.Widget):
460 """FlowWidget list, same arguments as GenericList, with an additional one 'max_height'""" 461 """FlowWidget list, same arguments as GenericList, with an additional one 'max_height'"""
461 signals = ['click','change'] 462 signals = ['click','change']
463 _sizing = frozenset(['flow'])
462 464
463 def __init__(self, options, style=[], max_height=5, align='left', option_type = SelectableText, on_click=None, on_change=None, user_data=None): 465 def __init__(self, options, style=[], max_height=5, align='left', option_type = SelectableText, on_click=None, on_change=None, user_data=None):
464 self.genericList = GenericList(options, style, align, option_type, on_click, on_change, user_data) 466 self.genericList = GenericList(options, style, align, option_type, on_click, on_change, user_data)
465 self.max_height = max_height 467 self.max_height = max_height
466 468
830 def __init__(self, title, message, style=['OK'], **kwargs): 832 def __init__(self, title, message, style=['OK'], **kwargs):
831 GenericDialog.__init__(self, [urwid.Text(message, 'center')], title, style, ok_value=None, **kwargs) 833 GenericDialog.__init__(self, [urwid.Text(message, 'center')], title, style, ok_value=None, **kwargs)
832 834
833 ## CONTAINERS ## 835 ## CONTAINERS ##
834 836
835 class ColumnsRoller(urwid.FlowWidget): 837 class ColumnsRoller(urwid.Widget):
838 _sizing = frozenset(['flow'])
836 839
837 def __init__(self, widget_list = None, focus_column=0): 840 def __init__(self, widget_list = None, focus_column=0):
838 self.widget_list = widget_list or [] 841 self.widget_list = widget_list or []
839 self.focus_column = focus_column 842 self.focus_column = focus_column
840 self.__start = 0 843 self.__start = 0