# HG changeset patch # User Goffi # Date 1395411293 -3600 # Node ID 0afff3c54b6eba96eab413e65196394c2f4f7833 # Parent 62c4288e5a9742ec30c69d7332736143fc28f941 replaced deprecated set_focus by focus_position diff -r 62c4288e5a97 -r 0afff3c54b6e urwid_satext/sat_widgets.py --- a/urwid_satext/sat_widgets.py Wed Feb 26 15:40:16 2014 +0100 +++ b/urwid_satext/sat_widgets.py Fri Mar 21 15:14:53 2014 +0100 @@ -504,7 +504,7 @@ for widget in self.content: if widget.getValue() == value: widget.setState(True) - self.list_box.set_focus(idx) + self.list_box.focus_position = idx return idx+=1 @@ -885,7 +885,7 @@ instr_wid = urwid.Text(instrucions+':') edit_box = AdvancedEdit(edit_text=default_txt) GenericDialog.__init__(self, [instr_wid,edit_box], title, style, ok_value=edit_box, **kwargs) - self._w.base_widget.set_focus('body') + self._w.base_widget.focusposition = 'body' class ConfirmDialog(GenericDialog): @@ -918,7 +918,7 @@ def addWidget(self, widget, width): self.widget_list.append((width,widget)) if len(self.widget_list) == 1: - self.set_focus(0) + self.focus_position = 0 def getStartCol(self, widget): """Return the column of the left corner of the widget""" @@ -954,7 +954,12 @@ """Return selected widget""" return self.widget_list[self.focus_column][1] - def set_focus(self, idx): + @property + def focus_position(self): + return self.focus_column + + @focus_position.setter + def focus_position(self, idx): if idx>len(self.widget_list)-1: idx = len(self.widget_list)-1 self.focus_column = idx