Re: Model redesign?

"Samuele Pedroni" <[email protected]>
Newsgroups gmane.comp.python.anygui.devel
Message-ID <04df01c263d8$bf3989a0$6d94fea9@newmexico>
[me]
> From: Magnus Lie Hetland <[email protected]>
> >   >>> link(btn, 'update', mdl.set)
> >
> > Here, of course, mdl.set will be passed lots of attribute/value pairs,
> > most of which are not interesting at all.
>
> update should be generated both on push/pull?
>
> the problem is only to avoid that mdl.set triggers btn.set recursively, which
> means extending a bit the functionality of event sends or not use events for
> the above controller functionality...

the latter by the way is what more or less Dallas's code already do. So I agree
with Magnus that is far from true that it's wasted effort ... What changes is
that the model observes the compenent instead of having the componenet take
care of directly updating the model.

It should be noted that under this approach unless one knows that no model is
attached to comp, is not guaranteed that this works:

L=['a',...]
comp.items=L

# later
L.insert(0,)
comp.push('items')

unless set({items = }) for a list change the a preexisting list in-place...

Otherwise the above idiom to be model-agnostic under this approach should be:

comp.items.insert('items',...)
comp.push('items')

regards.







-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.