[Urwid] How do you use SimpleListWalker?

Dominic LoBue dom.lobue at gmail.com
Fri Jun 19 12:51:18 EDT 2009


Perfect! Thanks, that helps a lot. Turns out the reason I was having so many
problems with SimpleListWalker is because my data was nested inside an extra
pair of square braces :/

What makes SimpleListWalker inappropriate for larger lists? For a quick test
I used Text rather than Button, but I'm able to scroll through all 2600
conversation threads rather quickly. No CPU spikes or anything.

This application is a learning experiment, so while I value the ease and
simplicity of ready-made classes a-la SimpleListWalker, if there's a better
or more "correct" way of doing what I'm trying to accomplish, I'd love to
learn.

Dominic

On Fri, Jun 19, 2009 at 9:13 AM, Ian Ward <ian at excess.org> wrote:

> Yes, browse.py could use some cleaning up and better comments.
>
> For short lists SimpleListWalker is just fine.  Yes, it should contain a
> list of flow widgets.
>
> Ian
>
> Dominic LoBue wrote:
> > Ian,
> >
> > Thanks for clearing that up for me. I've looked through browse.py
> > several times, but I just get lost every time. I really don't need
> > anything more complex than the SimpleListWalker or the
> > PollingListWalker, as I'm not planning on showing anymore more than a
> > short summary of the conversation. I don't have any plans to expand
> > the conversation in the index view.
> >
> > I take it that while SimpleListWalker acts like a regular list, its
> > supposed to be a list of widgets, correct? Meaning that the data would
> > be structured from the ListBox on down like so:
> > urwid.ListBox(
> >     urwid.SimpleListWalker([
> >         urwid.Button(conversation), urwid.Button(conversation) ]))
> >
> >
> > Dominic
> >
> > On Fri, Jun 19, 2009 at 5:46 AM, Ian Ward<ian at excess.org> wrote:
> >> A ListWalker is used by the ListBox class to determine what widgets are
> >> displayed in the ListBox, without the ListBox needing to know how that
> >> list is generated.
> >>
> >> SimpleListWalker acts like a regular list, so you can add and remove
> >> items from it and the ListBox will be updated.
> >>
> >> PollingListWalker is a class for maintaining backwards compatibility
> >> with old versions of Urwid that would let you pass a list in to the
> >> ListBox constructor.  It has to check the list contents each time the
> >> ListBox may be updated, making caching useless.  You don't want to use
> >> it for new code.
> >>
> >> What you need is your own custom ListWalker class.  See the browse.py
> >> example, it has a custom ListWalker that displays a tree view of files
> >> on the filesystem, with the ability to expand and collapse that tree.
> >>
> >> Ian
> >>
> >> Dominic LoBue wrote:
> >>> Hello,
> >>>
> >>> I'm writing an email reader with urwid, but I'm confused as to how the
> >>> SimpleListWalker class works. Is it just a metaclass that you can
> >>> extend to make writing your own custom listwalker easier, or should
> >>> you be able to use it on its own?
> >>>
> >>> Also, what's the difference between SimpleListWalker and
> >>> PollingListWalker? My application is going to thread emails and the
> >>> index view is going to show conversations (like gmail), with
> >>> conversations with recent activity pushed to the top, so I'm not sure
> >>> which walker is more appropriate, or if its even necessary to bother
> >>> with.
> >>>
> >>> Keep up the good work with urwid!
> >>>
> >>> Dominic
> >>>
> >>>
> >>> _______________________________________________
> >>> Urwid mailing list
> >>> Urwid at lists.excess.org
> >>> http://lists.excess.org/mailman/listinfo/urwid
> >>>
> >>
> >>
> >> _______________________________________________
> >> Urwid mailing list
> >> Urwid at lists.excess.org
> >> http://lists.excess.org/mailman/listinfo/urwid
> >>
> >>
> >
> >
> > _______________________________________________
> > Urwid mailing list
> > Urwid at lists.excess.org
> > http://lists.excess.org/mailman/listinfo/urwid
> >
>
>
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20090619/38bff867/attachment.htm 


More information about the Urwid mailing list