[Urwid] Enhancements for Urwid

Ian Ward ian at excess.org
Mon Feb 5 14:45:00 EST 2007


Florian Festi wrote:
> We are currently looking for a text mode widget set and stumbled
> across urwid. Urwid looks very promissing but as we want to
> resemble out Gtk tools in text mode we miss some features:

Creating a text interface that resembles a GUI was never my intent when 
writing Urwid, so I'm sure there are many things missing :-)

> Widgets:
>  * ScrollBar (h/v)
see http://excess.org/urwid/ticket/10

>  * ScrolledWindow (ListBox + ScrollBar/h/h+v)
related to http://excess.org/urwid/ticket/9

I would like the scroll bars and scrolling regions to stay as separate 
widgets so that their placement isn't fixed (you might want to put some 
other widget between them, for example)

>  * Paned (h/v)
I think you can do something like this with Columns and Pile widgets. 
If not, could you be more specific?

>  * VerticalSeparator
see http://excess.org/urwid/browser/urwid/trunk/graph.py#L292
the "vline" widget is being used as a vertical separator

>  * Menu
related to http://excess.org/urwid/ticket/6
and http://excess.org/urwid/browser/contrib/trunk/rbreu_menus.py
It's not easy enough to do this right now.

>  * NoteBook
Is this a kind of tabbed view?  It should be pretty easy to do that with 
existing widgets.

>  * TreeView
related to http://excess.org/urwid/browser/urwid/trunk/browse.py
It is possible to create a tree view, but a generic tree view might be nice.

>  * Window
>  * Dialog
>  * ComboBox
>  * ComboEntry
related to http://excess.org/urwid/ticket/6
As with the Menu item above, this will be a lot easier once some canvas 
changes I'm working on right now are released.

>  * Edit
>   - have indicators for scrolled out text ('<' '>')
>   - have a more GUI-like variant with constant width editing field
This one should be pretty easy.

> Other features:
>  * Stacking: Having a sane way of putting widgets on top of each
>    other. These needs so be on a global level to avoid limitations
>    as in Overlay.
Would you give an example of what you are trying to do that is difficult 
in Urwid.

>  * Sensitivity: Disable parts of the UI depended on other selections
We could add a disabled state to all the usual widgets, but that would 
probably mean telling them to draw themselves in a different attribute 
(the themeing suggestion might help there)

>  * (In)Visibility: Hide parts of the UI depended on other selections
This is hard to do right now.  It would be easier if referencing widgets 
within their containing widgets was easier.

>  * Theming: a global way to set coloring and text graphics chars
>    and make all widgets of one type look the same. This may include
>    how some widgets are rendered. (Details to be worked out)
This is a very good idea.  We just need a nice clean way to do it, and 
some good default themes built in.

>  * Reduce the difference between BoxWidget and FlowWidget.
>   - May be just make the containers smarter
>   - May be merge BoxAdapter into BoxWidget
This is interesting, please elaborate.

>  * Clean up inheritance tree (make all widgets child of FlowWidget or
>    BoxWidge or BoxWidget and FlowWidget
Sure.

>  * More callbacks/events: Get finer control over the widgets without
>    subclassing (Edit being the first candidate).
Very true.  This should be easy.

>  * Support for a more dialog driven interface design
Yes, as an option.

>  * Generic main loop: Have all feature accessable without the need of
>    a custom main loop. May be just have a toplevel widget to handle that.
see http://excess.org/urwid/ticket/16

>  * (Glade to urwid converter)
Ha-ha!  That would be interesting..

> Ok, this is a pretty scary list and I am aware that most bullets need
> further discussion. On the other hand there is already code for some
> of the widgets. For us it does only make sense to put that much
> effort into urwid if these features go into the upstream urwid
> library. Are there any chances that this will ever happen?
Yes.  Many people seem to be looking for the same things you mention.

I'm happy to extend the library in that direction, as long as it remains 
easy to create keyboard-focused interfaces for people that prefer to 
create console apps such as irssi and vim.

It would be great to have someone that is familiar with GUI libraries 
like glade work on a GUI-like-personality module for Urwid.  All of the 
changes required to the existing parts of Urwid should be beneficial to 
everyone.

Ian





More information about the Urwid mailing list