changeset 127:88722f920b3c

added edit to access edit widget in InputDialog, and text property + minor docstring fixes
author Goffi <goffi@goffi.org>
date Sun, 24 Jul 2016 18:57:35 +0200
parents 5ab6a5ebd3b5
children 2a6b8742e44a
files urwid_satext/sat_widgets.py
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/urwid_satext/sat_widgets.py	Tue Jul 12 20:37:19 2016 +0200
+++ b/urwid_satext/sat_widgets.py	Sun Jul 24 18:57:35 2016 +0200
@@ -220,7 +220,7 @@
         """
         @param text: same as urwid.Text's text parameter
         @param align: same as urwid.Text's align parameter
-        @select_attr: attrbute to use when selected
+        @param selected_text: text to display when selected
         @param selected: is the text selected ?
         """
         self.focus_attr = focus_attr
@@ -255,7 +255,9 @@
 
     def setSelectedText(self, text=None):
         """Text to display when selected
-        @text: text as in urwid.Text or None for default value"""
+
+        @text: text as in urwid.Text or None for default value
+        """
         if text == None:
             text = ('selected',self.getValue())
         self.selected_txt = text
@@ -1150,7 +1152,7 @@
     def setCallback(self, name, callback, data=None):
         """Set the callback associated with a button press
 
-        @param name: one of "ok", "cancel", "yest", "no"
+        @param name: one of "ok", "cancel", "yes", "no"
         @aram callback(callable): method to call on requested action
         @param data: argument to send to the callback (first one will be the button widget)
         @raise KeyError if name is invalid
@@ -1166,10 +1168,14 @@
         if style is None:
             style = ['OK/CANCEL']
         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.edit = AdvancedEdit(edit_text=default_txt)
+        GenericDialog.__init__(self, [instr_wid, self.edit], title, style, ok_value=self.edit, **kwargs)
         self._w.base_widget.focusposition = 'body'
 
+    @property
+    def text(self):
+        return self.edit.text
+
 
 class ConfirmDialog(GenericDialog):
     """Dialog with buttons for confirm or cancel an action"""