Tomás Touceda wrote on 2010-05-29 13:41:
> The project's in github.com/chiiph/pim/ <http://github.com/chiiph/pim/>
> 
> As you can see, the UI is in curses, but since I'm having a lot of
> problems with key combinations, I saw that Urwid has that figured out
> really nice.
> 
> The problem I'm experiencing is that I need a simple UI layout. Just
> like vim or emacs: a big text widget where the editing takes place, and
> at the bottom 2 other text widgets of exactly 1 row height, one for
> status, and one to act as a command line.

You could use something like

Frame(body=Filler(edit_area), footer=Pile([status_line, command_line]))

This assumes edit_area is a text widget and needs to have blank lines
inserted below it to fill the available space.

> Since the editing itself is done with a plug-in, I don't need any
> special widget, just one that can display formatted text.

If you have your own handling for the editing, you probably should
create a custom box widget (one that gets told how many rows it has to
display text in) and use it in place of the Filler widget above.

Mapping the urwid widget API to your plug-ins might be a little tricky.
Look at http://excess.org/urwid/wiki/WidgetMethods and the Urwid source
code to get an idea of what this entails.

Another option if you already have a working curses interface is to just
use Urwid's input handling code.  Look at urwid/curses_display.py and
urwid/escape.py.

Urwid uses a static list of escape sequences for detecting user input.
It is not perfect, and I still need to add code that pulls the escape
sequences from terminfo when they are available, but it works well if
your users are using terminal programs common on Linux.

HTH,
Ian

_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to