changeset 74:0afff3c54b6e

replaced deprecated set_focus by focus_position
author Goffi <goffi@goffi.org>
date Fri, 21 Mar 2014 15:14:53 +0100
parents 62c4288e5a97
children 8ff563825080
files urwid_satext/sat_widgets.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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