[Urwid] Edit Widgets

Ian Ward ian at excess.org
Mon May 22 14:14:17 EDT 2006


Rebecca Breu wrote:
> Hi!
> 
> I attached two Widgets I derived from the EditWidget. One is for entering
> passwords (it displays user input as asterisks) and one is for entering
> filenames (with <TAB>-completion as in shells). Maybe someone can use them.

I wonder if for the SecretEdit class it would be easier to just override 
the get_text() member function like this:

def get_text(self):
	return self.caption + "*"*len(self.edit_text), self.attrib

I haven't tried it but it looks like it should work :-)

> 
> The latter is my substitute for a file dialog. Speaking of file dialog:
> Ian, you said you would like to have a file dialog in urwid. If you haven't
> already started, I would try to create one. (*try*, I don't want to promise
> anything... ;-)

Please go right ahead.

I have a few other things rolling around in my head right now:

* scroll bars - vertical ones first, but I will keep horizontal 
scrolling in mind. This will involve some extra data tagging along with 
the canvas objects for the scroll bar. The scroll bar itself will be a 
separate widget that wraps the widget with partial contents displayed. 
List walker classes will need to implement a couple new optional methods 
for scroll bars to display relative positions properly.

* pop-ups and drop-downs - a nice way to render widgets "above" and 
"outside" of the current widget. This will also use extra data tagged 
onto canvas objects that will be handled by a special overlay widget 
that wraps the widgets "popping up".

* ISO-2022 characters - initially just the line drawing and "regular" 
graphic characters for non-UTF8 terminals. This will change the way text 
is stored in canvases to also include information about which character 
set is being used for each character. It will also make it easier to add 
ISO-2022-JP and other encodings later.

* something like a "pack" method on text widgets to find out what the 
minimum column width required for their display would be - this would be 
useful for menus, pop-ups and drop-downs.

* asynchronous operation of get_input() function on display modules - 
Right now that method will block waiting for input. I want to let people 
use their own event loop so that they aren't forced to use threading for 
Urwid applications that don't block on user input.

* Frame and Pile unification - If I add support for box widgets in Pile 
widgets then a Frame becomes just a special case of a Pile.

* mixed box and flow widgets in Columns - sometimes it would be nice to 
fill the extra space in one column based on the screen rows required by 
another column.

* Canvas performance improvements - if the screen layout has many nested 
columns the amount of time render() takes can be O(N^2). This is not a 
desirable property.

.. these are obviously not all for the next release :-)

Ian




More information about the Urwid mailing list