Re: I'm still here...
"Samuele Pedroni" <[email protected]>
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <043901c260cf$8149f640$6d94fea9@newmexico> |
From: Dallas Johnston <[email protected]> > > I've got a very simple sequence in mind that I have almost finished in the code itself, and it doesn't require the push-pull or rawSet mechanisms. This method assumes (perhaps to presumptuously?) that Proxy is satisfied with Model taking over management of Wrapper's property by essentially becoming the state's element. > > widget.text = TextModel() > --> Attrib.__setattr__ -> > [If Model] { > --> TextModel.removed(getSetter(name)) > -> unlink( TextModel, setter ) > , > --> TextModel.assinged(getSetter(name)) > -> link( TextModel, setter ) > , > -> Attrib.state[name] = val > } > This makes sense, although things get complicated if we want (as Magnus suggested in order to simplify wrappers) to have setters that are called or not depending on whether wrappers.widget is set. Another remark: the __setattr__ we are referring here is on the Proxy, the setter is OTOH a Wrapper method. At the moment Attrib knows nothing about wrappers, it calls Proxy.push/pull that know about wrapper. > > widget.text = "Hah, hah.. fooled you!" > --> Attrib.__setattr__ -> > try { > --> Attrib.state[name].setProp(val) > -> send( TextModel, val ) > } > else{ > --> getSetter(name)(val) > } But it seems, we have still a problem with retrieving comp.text ... because for that we have to pull the text value from the widget (I mean the backend/toolkit widget) and then set it in the model/in state, but that should then broadcast the corresponding change-event to all handlers but not to setter one because that would be still a spurious call (vs. the spurious push call with the other approach). > Only problem with this is that you run into trouble trying to delete the model from out of Proxy. Ie. 'del widget.text' would only successfully delete a temporary return from .text . > > Perhaps we could clean things up a bit by offering a model-installation API? Like widget.installTextModel(TextModel()), where the handling of which can be dynamic, in that __getattr__ would parse the function name and delegate the responsibility of creating the model environment to the strata-model component that I suggested earlier?? Yes, personally, I would prefer comp.prop and comp.prop= to deal with values/and values in models, and have a different spelling for installing/deinstalling models, and not have the modify(prop=...) idiom anymore. regards ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf