| 11 | | |
| 12 | | |
| 13 | | == Container Widgets == |
| 14 | | |
| 15 | | The following widget classes will be made more consistent: |
| 16 | | * `Pile` |
| 17 | | * `Columns` |
| 18 | | * `Overlay` |
| 19 | | * `ListBox` |
| 20 | | * `Frame` |
| 21 | | * `GridFlow` |
| 22 | | |
| 23 | | Container widgets will provide a uniform way to access their children. |
| 24 | | Inserting and removing children |
| 25 | | will be possible with some of the widget types. |
| 26 | | |
| 27 | | New container API: |
| 28 | | |
| 29 | | * .focus property (GET) that is the widget that has the focus. None for leaves. '''DONE''' |
| 30 | | * .focus_position property (GET/SET) property that is a position value that this widget understands. Raises IndexError on GET/SET for leaves or when being set to an invalid value. '''DONE''' |
| 31 | | * .contents property (GET) (SET as well in most cases) is a mapping or list-like (for simple containers) object whose keys are positions and values are (widget, container_specific_options) tuples. container_specific_options may be created from .options() method on the container object, for forwards compatibility. '''DONE''' |
| 32 | | * `[x]` (a.k.a. `.__getitem__(x)`) is equivalent to `.contents[x][0].base_widget` '''DONE''' |
| 33 | | * `.get_focus_path()` method list of focus positions down to the leaf widget, skipping all decoration widgets (they only ever contain one item) '''DONE''' |
| 34 | | * `.set_focus_path(x)` set the focus positions along each widget in the path. useful for restoring a value previously returned from get_focus_path(). raises IndexError on failure '''DONE''' |
| 35 | | * `.__iter__()` iterate over all the positions in the container in a consistent, but possibly surprising order (ListBox is currently the only widget that *might* return these in a "strange" order -- starting from focus and moving down). This may be an unbounded iterator. '''DONE''' |
| 36 | | * `.__reversed__()` iterate like `__iter__()` but in reverse, for supporting reversed() in Python 2.6 and later. '''DONE''' |
| 37 | | |
| 38 | | "Maybe-later" additions to container API: |
| 39 | | |
| 40 | | * `.get_descendant(x)` get the base_widget with path x |
| 41 | | * .set_descendant(x, w) attempt to set the base_widget at path x, returns the original base_widget that was replaced. raises IndexError or ContainerWidgetError on failure |