On 12/11/06, Ed Leafe <[EMAIL PROTECTED]> wrote:
>
> On Dec 11, 2006, at 9:55 AM, Carl Karsten wrote:
>
> > I need to know if Ed/Paul want to use the pattern. Ed has done it,
> > so I don't
> > need to implement it for him to understand it. I think Paul gets
> > it, but
> > doesn't understand the value of it.
>
> The i-layer was the best solution for the problem, given VFP's
> object model. Python has a very different model, and the i-layer
> pattern is not the best solution by a long shot.
I agree with Ed on this one. See below for reasoning.
Take a look at the ClassDesigner code; specifically, the
> ClassDesignerControlMixin.py file and the ClassDesignerFormMixin.py
> files. This is more the pattern that should be used for developer-
> level modifications to the framework. Write a mixin that supplies the
> needed mods, and instead of creating hard-coded subclasses, generate
> the classes on the fly.
A good example of this would be the dRefectorMixin class that I just wrote.
I wanted to be able to add some utility function to various forms, panels,
and dialogs, so I wrote some functions for stuff like creating a Sizer with
various controls and labels from a passed tuple. Makes sense for me because
I code GUIs by hand but for someone using the class designer they will never
touch it. So it's in a mixin file. I think that this would go in your
i-class files but then you have to duplicate the code for every class you
want. For me, I just have to change the declaration of my class from class
MyForm(dabo.ui.dForm): to class MyForm(dabo.ui.dForm, dabo.ui.dRefactorMixin):
and the MyForm class instantly inherits those functions in addition to the
dabo ones. If you are worried about the dabo functions overriding your
functions, put the mixin file before the dabo control in the declaration.
SVN the latest development code and look at dRefactorMixin or any of the
other Mixin files and you should get an idea.
The reason the i-layer was used was VFP could only inherit from one class
and not the two or more that I showed above. With only one class to derive
inheritance from, it made it impossible to use Mixin files as a solution and
thus the i-layer was born as a solution. Since Python has multiple
inheritance builtin to it's object model, it makes no sense to use an
i-layer.
I'm sure that if I grokked metaclasses better, I would probably want
> to go that route instead, based on what I know about them. But that's
> beyond my skills at the moment.
>
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
>
>
>
> _______________________________________________
> Post Messages to: [email protected]
> Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
>
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users