On Tue, Nov 24, 2009 at 9:17 AM, Ian Ward <[email protected]> wrote:
> Dominic LoBue wrote:
>> On Mon, Nov 23, 2009 at 8:12 AM, Ian Ward <[email protected]> wrote:
>>> Dominic LoBue wrote:
>>>> I'll play with set_focus_valign and see what I get, thanks.
>>>>
>>>> As to using pile, I need multiple widgets. I cut the message body up
>>>> into several pieces and so I can collapse replies and whatnot. I need
>>>> the multiple widgets so I can use focus's keypress context.
>>> What I'm saying is you should put the header and body pieces into a Pile
>>> in the ListBox so that the ListBox will always try to keep the whole
>>> thing visible.  If you are doing special things with the listbox's focus
>>> to create different effects, consider making a custom widget that can
>>> handle the keypresses, like this:
> [...]
>>
>> I understand what you're suggesting, and what I'm saying is that goes
>> against my design.
>>
>> You're welcome to check out what I have so far:
>> http://github.com/dlobue/achelois
>>
>> Check out the file read_mode.py. It contains the listbox, listwalker,
>> and all related widgets for reading emails.
>
> Oh, ok.
>
> You could try something like:
>
> listbox.set_focus(header_position)
> listbox.set_focus_valign('top')
> main_loop.process_input(['down'])
>
> That last line will cause the focus position change to actually happen,
> because the size information is passed along with the keypress method,
> and 'down' might move the focus back to the body.  An alternative would
> be to pass some input that doesn't do anything (just use the focus
> setting side-effect) then call set_focus again on your listbox.
>
> Ian
>
> _______________________________________________
> Urwid mailing list
> [email protected]
> http://lists.excess.org/mailman/listinfo/urwid
>

Perfect! That worked! Thanks!

Two questions though:
a. Why do I need to call the lsitbox's set_focus method instead of the
listwalker?
b. Is there any way to achieve the same effect as this without all the
extra overhead of redrawing the screen three times?

Thanks again!
Dominic

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

Reply via email to