[Urwid] Re: placing buttons and widgets

Fabian Braennstroem f.braennstroem at gmx.de
Sat Oct 7 12:07:27 EDT 2006


Hi,

* Rebecca Breu <rebecca at rbreu.de> wrote:
> 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...

Thanks for your advice!
>
> I have done something vaguely similar:
>
> http://sourceforge.net/project/screenshots.php?group_id=102081&ssid=34657
>
> Sourcecode:
>
> http://sourceforge.net/project/showfiles.php?group_id=102081&package_id=192185
>
> 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 will see, if I understand your code; thanks!
>
>
>> 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...

Thanks! When reading it, I get one more question in mind :-)
For an urwid based lfm I would like to set my own
keybindings in a vim-like way, e.g. I don't want to use the
Up and Down key, but 'j' and 'k' for scrolling to the next
line. Is there a urwid specific way to define those
keybindings or would be similar to lfm, where I just define
a function which goes to the next item in a 'list'!?

> Okay, I hope that any of this helps...

Yes, thanks a lot!

Greetings!
 Fabian





More information about the Urwid mailing list