Looking for simple record-oriented table navigator in urwid
2012-06-30 15:31:09 GMT
As part of a unix CLI utility, I would like to implement a widget to help the user act on the contents of this one directory (which is special for this utility).
(FWIW, the directory interface I have in mind is inspired by Emacs's dired mode, although for my purposes I need only a small subset of dired's functionality.)
So, to be more specific, I'm looking for a *simple* urwid-based implementation of a "navigable table of records", with the properties similar to the following (they are all quite basic and commonplace by today's standards):
- the table takes up the entire window (irrespective of the number of records available), and consists of one fixed header row at the top the window, one message/status row at the bottom, and a records "pane" in-between, showing as many records as can be accommodated in the available space;
- the table can be "navigated" by pressing the up- and down-arrow keys; here "navigation" consists of nothing more than changing the record that "has the focus", aka, "the current record", as indicated by a change of color (e.g. reverse video), or simply by the vertical position (i.e. the row) of a typical character-sized rectangular cursor;
- all records consist of the same number of fields, and always take up one row per record (hence, field contents are clipped if necessary);
- all fields except for the rightmost have fixed widths; the width of the rightmost field expands to fill up the window's width; only the width of the rightmost field is affected by resizing of the containing window.
So, if anyone knows of a *simple* urwid implementation of an interface similar to the one outlined above, and that I could at least study, please point me to it.
PS: I was really excited to discover urwid and to find the example file browser at http://excess.org/urwid/browser/examples/browse.py, since I thought I could adapt this code to what I'm trying to do. But, after studying browse.py for a few hours (along with the rest of the urwid docs), I had to give up. I just couldn't wrap my brain around it! Clearly, browse.py is well beyond my IQ. In fact, after inspecting browse.py, I now fear that urwid in general is beyond my IQ. So I'm bummed, because I was really psyched to use urwid for this. What keeps this hope still alive is that, since the functionality I have in mind is *significantly simpler* than browse.py's (for example, I don't need tree navigation, with expanding and collapsing of nodes, etc.), an urwid-based implementation of it may still be something that I can handle. Hence my first post to the urwid list.
_______________________________________________ Urwid mailing list Urwid <at> lists.excess.org http://lists.excess.org/mailman/listinfo/urwid