On Mon, Nov 23, 2009 at 8:12 AM, Ian Ward <[email protected]> wrote: > Dominic LoBue wrote: >> On Mon, Nov 23, 2009 at 5:46 AM, Ian Ward <[email protected]> wrote: >>> Dominic LoBue wrote: >>>> The best example I can give you is the header widget. The header >>>> widget has two modes: summary and detailed. In summary mode the widget >>>> says something along the lines of "Sent <date> from <sender>". In >>>> detailed mode the widget is 5 lines, one line each for From, To, Cc, >>>> Sent, Subject. Each individual message in a conversation is made up of >>>> several widgets. From any of these widgets when you press the >>>> appropriate key, you can expand the header widget. Getting to the >>>> point, I open a conversation, move the focus down to the body of the >>>> message, and toggle the header detail widget. When the header widget >>>> is toggled to detailed, the widget expands upwards offscreen and all >>>> that is visible is the last line. >>> You might try putting the header and content inside a Pile widget. That >>> way they look like a single widget to the ListBox and you will likely >>> get the behaviour you are looking for. >>> > [...] >> >> 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: > > class EmailWidget(urwid.WidgetWrap): > def __init__(self, email): > self.__super.__init__(urwid.Pile( ..header, parts of email.. )) > def keypress(self, size, key): > # special handling here, manipulating self._w (the pile) > # or its contents > > > _______________________________________________ > Urwid mailing list > [email protected] > http://lists.excess.org/mailman/listinfo/urwid >
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. Dominic _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
