Ticket #66 (closed defect: fixed)
Dynamically updating a Pile causes exception
| Reported by: | robla | Owned by: | ian |
|---|---|---|---|
| Priority: | major | Milestone: | Urwid 1.0.0 |
| Component: | unknown | Version: | |
| Keywords: | Cc: |
Description
Using pile.widget_list.append(myfield) to add a widget to an existing Pile causes two problems:
1. The new field fails to render
2. Navigating to where the widget should be causes an exception to be thrown
Snippet of IRC conversation on this subject:
(05:42:25 PM) wardi: hmm, that should work
[...]
(05:45:27 PM) wardi: the way Pile is implemented atm it keeps two lists, one of the widgets and one describing how each is to be displayed (item_types)
(05:47:12 PM) wardi: you could build a new pile every time you want to add an item, or do self.pile.item_types.append(('flow', None)) after appending the widget
(05:48:02 PM) ***robla tries the item_types thing to see if that does the trick
(05:48:36 PM) wardi: but that's a bug.. it should be defaulting to something and not crashing the way you're seeing
To repro, run the attached script, hit "ctrl n" to create new fields, and then try to navigate to the bottom. The script will bomb at that point.
