how to extend an instance of visual class: was using RADs in OO way

Alex Martelli aleaxit at yahoo.com
Fri May 23 10:58:12 EDT 2003


Serge Boiko wrote:

> On Fri, 23 May 2003 11:50:49 +0200, Alex Martelli wrote:
> 
> Thank you, Alex, you gave me a nice portion of intellectual food :-)
> 
>> 
>> I'm not quite sure which settings are "relevant" to you here, i.e.
>> which ones you want to pick up from the 'other button' -- as you
>> appear to want to override the text, it seems that only the geometry
>> (layout) might perhaps be relevant.  But anyway, more generally, your
>> code clear DOES have to know what to pick up from the other widget
>> you're replacing and what to override, so you might as well code that
>> knowledge into appropriate 'clonestate' methods of your specialized
>> widgets (optionally and appropriately called from their __init__).
>> 
> It was only a simple example to demonstrate the problem. Actually
> I'm *really* interested in the layout settings rather than in something
> else. My idea is to use the "visual proxy pattern" proposed by
> Allen Holub.

Sorry, I'm unfamiliar with this, but I can guess from its name -- and in
any case you could pick up the layout-settings from the widget you are
substituting (nor even caring about its type then, really).


>> There are of course many other approaches, such as ensuring that your
>> specialized widgets get onto the widget palette available to the GUI
>> builder tool so that the form designer can choose them if desired;-).
> 
> Absolutely, but for the specific case of visual proxy architecture
> it doesn't seem to be the best way. Perhaps, it's a matter of my
> personal habits: I love to write code in emacs and use RAD only to
> design layouts. That is why it's important to me to separate my code
> from the code generated by the RAD.

This separation is or should be important to everybody.  Nevertheless
getting the right classes in the GUI designer's palette is still useful,
if an when feasible -- more for things that affect geometry I guess, if
geometry (layout) is all you care about, but still...


Alex





More information about the Python-list mailing list