Models...
[email protected] (Dallas Johnston)
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I have spent some time today on the Models, implementing a slightly modified version of my delegate idea. Instead of having an actual class do the delegation, which would break encapsulation =), I have delegated (irony intended) all the model management code to the Proxy class.
In fact, due to Proxy handling all the lower level push/pull functionality, there really was no other clean way to deal with it. Also, by thus having Proxy marshal values into the Models, Attribs becomes *far* less complicated, and the Wrappers pushing values up into the Proxy causes Proxy to update all related models =).
As of now, BooleanModel works like a charm, but there are still very menial bugs to iron out, and I need to get some sleep.
Only one question though... from the test_modv3.py it seems that the use of the model is inconsistent. For example, the calls to link(newbtn.on, printit2) and log('printit2:',newbtn.on) seem to represent the presence of slight confusion in the mind of the author with regard to what newbtn.on is supposed to represent in each call. In the first case, newbtn.on is assumed to return the actual model object, whereas the second case is expecting the value that the model represents.
And discerning wich of these expectations is in fact based in a more credible comprehension of the matter is a little more than subtle.
In reality, if you are wanting to retrieve the value that he model represents, then 'val = widget.property', where 'property' is a model, proves the more appealing idiom. However, when one wants to call a user-provided method on the model, which is the real purpose of user-provided models, then a call like 'widget.property.calculate()' will fail miserably, as 'widget.__getattr__' will have returned the value that 'property' represents.
And I cannot refer to the old version of Attribs.py without mucking about with cvs, so I'll have to look into it tomorrow.
cheers all,
--Dallas
__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf