Christian Robottom Reis <[EMAIL PROTECTED]> writes:
> On Sun, Jul 25, 2004 at 02:52:24AM -0500, Doug Quale wrote:
> This is interesting, though I question the design of that
> if-looks-like-a-switch-with-a-load-of-isinstances <wink>.
Yes, my implementation is ugly and should be improved. It was a quick
hack.
> Kiwi Proxies do this by creating individualized "descriptors" -- each
> widget gets its own WidgetProxy which has read() and update() methods,
> and there are WidgetProxies for every widget type [for which a
> descriptor would make sense]. This is used internally by the Kiwi Proxy,
> but could be made generally available (and even transparently available,
> as your descriptor class really is).
>
> So in this case you could hack around them a bit and have
>
> class MyController(GWidget):
> name = LabelProxy('name')
> age = SpinButtonProxy('name')
>
> Maybe the StudlyCaps isn't what you're looking for (and that's the
> easiest part to change), but this solution tends to scale nicely (and
> you can add extra stuff to specific proxies, such as automatic format
> and type conversion).
That's a better idea than using the single descriptor class. I don't
recall if I ever considered using a separate descriptor class for each
widget type. Probably I never thought about it, but I certainly
should have. Fortunately he amount of code I have using the ugly
implementation is small enough that I can take advantage of your good
advice and fix it.
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/