Re: Model redesign?
"Samuele Pedroni" <[email protected]>
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <025401c263cd$943bfcc0$6d94fea9@newmexico> |
From: Magnus Lie Hetland <[email protected]> > Just some thoughts based on earlier model discussions... (These are > just loose thoughts, so Dallas: Don't panic -- we can probably still > use much/most of your code ;) > > It seems that we're having problems with the attribute-bound-to-model > design. An alternative has been proposed with special model > registering methods. If we are to drop my MVC design in favour of > something else, I'd rather have things be even simpler, and to make > Proxies even less coupled with models. > > So... I'm back to using the event system again (which was my original > idea). Let's (for now) ignore the fact that Attrib.set(...) takes > Option objects as positional arguments, and get to the specifics of > that later. Then my idea works basically as follows: > > >>> btn = Button() > >>> mdl = NumberModel(name='x') > >>> link(mdl, btn.set) > > Here, when mdl is modified, btn.set will be called. To implement the > controller part of things, Components can be observable as well: but you probably want to be able to bind an non-through-ui-modifiable model to more than one components, but yes it's workable. > >>> 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... OTOH I'm fine with this approach. regards. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf