[Urwid] Re: placing buttons and widgets
rebecca at rbreu.de
Fri Oct 6 08:41:14 EDT 2006
Zitat von Fabian Braennstroem <f.braennstroem at gmx.de>:
> > Thanks to both! Maybe, I can 'clone' lfm using your new
> > filechooser and urwid one day ... the hardest thing, or
> > better the first thing, would be to get the interface a
> > similar look :-) From there on it should be possible to use
> > the corresponding functions from lfm ...
The "main view" could be a Columns widget with to columns (for the
two directory listings), and inside each column another Column widget
with columns for filename, size, date. To get the menus at the top and
buttom, put the "main view" inside a Frame or Pile widget. If you can live
without those fancy thin unicode lines, that's not so hard to do. Otherwise
the LineBox widget could help...
I have done something vaguely similar:
I'm not sure if I would recommend having a look at the code, though. Mmh, but
I remember that it took me some time to get the "table" in the right part
of the screen right since I wanted the rows in the table to be selectable only
as a whole (So that in each column are always the same rows selected. I hope
you understand what I mean). If you want to do the same, maybe a look at my
TableColumns widget in urwid_extensions.py could help.
> I got one more question. Is it possible to create a command
> prompt like the midnight commander has? It might be a nice
> additional feature...
Midnight Commander has a single line prompt and displays the output in the
original shell. A first idea: Use an Edit widget (the prompt itself would go
into the caption) for the command input. The keypress method of the the Edit
widget has to be altered so that the enter key executes the command
(using Python's subprocess module) and clears the Edit widget. To display the
output, create a new widget that disappears as soon as the user presses
enter. That way you won't see the original shell as in mc, but well...
Okay, I hope that any of this helps...
More information about the Urwid