OK, turning to implementing a TreeBox, I have a few questions.. We see that this would-be TreeBox will share a lot of code with ListBox, so assuming I want to subclass ListBox, what do I have to overwrite?
- keypress() needs to be able to deal with moving up and down the tree, and (later) also to trigger folding of subtrees. - decorations will be drawn in `render`, which - this being a box widget - takes a size-tuple and returns a Canvas of that size. So I need to overwrite `render`. - calculate_visible: Not sure what exactly this does, but I'm sure this will be more complicated for trees than for lists: we want to be able to also scroll to the left/right when changing focus beacause otherwise we could only ever show trees of bounded depth if we choose to indent child nodes. I do not understand the docstring of this method. please explain. How does this relate to `make_cursor_visible`? - get_cursor_coords: i presume this is for dealing with a mouse cursor? If so, why is this done in this widget and not some lower one? I mean the exact location of a mouse cursor on the screen is surely something that one directly gets from a Screen? - set_focus_valign this is to position the visible area around the focussed widget. It needs to be overwritten for TreeBox as the visible area is now two dimensional. Whats the difference to `shift_focus` and why does the latter need to know the size of the whole TreeBox? - Do i need to overwrite/define `_contents` to ensure compatability with some higher level Box-container API? - what does `ends_visible` return? - why does keypress need to know the size the widget is going to be displayed? This is a more general question because I don't see why one could ever need this for any Widget. Sorry to nitpick - its hard to understand other peoples code, especially these complex widgets :) Cheers, /p
signature.asc
Description: signature
_______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
