On Thu, Nov 8, 2012 at 12:16 AM, Keith Dart <[email protected]> wrote: > Hello urwid people, > > I've been writing a terminal UI using urwid for my projects database > editor. This is a UI that edits a database through the sqlalchemy API. > It actually looks pretty nice, but it wasn't as easy as I first thought > it would be. Getting the focus to change exactly as I want it seems to > be very difficult. I also had to dive into the code to really > understand how to use it and create new widgets. I still often > get exceptions when first writing UI widgets due to using box > widgets where a flow is required, and vise versa. The reference > docs should say what kind it is.
That's a good point. The widget sizing modes are only really documented here: http://excess.org/urwid/docs/manual/widgets.html#box-flow-and-fixed-widgets But not in the reference for each widget. I think signals are also missing from most widget docs. (Patches welcome!) With some of the planned changes to rendering and improvements to container widgets you should start to get better error messages about using widgets in an incompatible way, and the errors will come before the whole tree is rendered (closer in the code to where the problem actually is) If there is anything else that could be changed about the documentation to better explain the different sizing modes please let me know. It's hard writing good intro docs when you know something so well! > Anyway, if anyone has time I would appreciate a code review. > > I have one question: is it necessary to unregister signals when an > object is no longer needed (goes out of scope)? Will it "leak" objects > and memory if I don't? There isn't an unregister_signal function. Do you mean "disconnect_signal"? connect_signal() does keep normal references to the function and data that will be called, so they won't get garbage collected and you might have to worry about leaking memory if you are regularly connecting new functions to a long-lived widget. This behaviour allows closures to be used as callbacks. There is some work around registering callbacks and data with weak references that I'll be looking at merging very soon that might be interesting to you. Ian _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
