# HG changeset patch # User Goffi # Date 1469379455 -7200 # Node ID 88722f920b3c70454423653768a1b350e6937764 # Parent 5ab6a5ebd3b52c6f63d05a76773381b586b8e6ae added edit to access edit widget in InputDialog, and text property + minor docstring fixes diff -r 5ab6a5ebd3b5 -r 88722f920b3c urwid_satext/sat_widgets.py --- 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"""