Re: Headcount

Magnus Lie Hetland <[email protected]>
Newsgroups gmane.comp.python.anygui.devel
Message-ID <[email protected]>
Samuele Pedroni <[email protected]>:
[snip]
> there's a
> 
> if not self.widget: return
> 
> at the top of all setFoo methods (except setContainer's that trigger widget
> creation)

Hm. That's a bit like what we had in 0.1. It's OK (the None stuff
seems like a clean solution) but perhaps we could put this check in
the dispatcher (i.e. in the pull/push methods of the Wrapper) instead?
IOW, check for self.widget == None -- if not, start looking for an
accessor. I definitely think this is a refactoring worth doing (even
though I haven't really looked at your new code yet ;)

[snip]
> Another question is:    now  proxy.wrapper is kept in state and there's a
> comment asking whether it should be that way.

Yeah; It really shouldn't. Now that we have initial underscores back
again, we could start using proxy._wrapper, of course... (Or we could
exempt it from state handling like proxy.state itself...)

> For now I have added a non-in-state _wrapper_set flag that is set to true when
> wrapper is set to a concrete wrapper.

Hm... OK. Doesn't sound like an ideal solution.

> I need to check for wrapper presence in push and pull that are called by the
> Attrib constructor before wrapper is set
> in order to do the right thing, i.e. return without after doing nothing.

I see.

How about simply generalising the test

  if attr == 'state'

to something like

  if self.isStateVariable(attr)

or something in Attrib? Then it would be easy for Proxy to override
the default Attrib behaviour (only dropping 'state' and anything
beginning with '_') and make 'wrapper' a non-state variable.

> Should wrapper be out of state and become _wrapper, then we need a getWrapper
> or all occurences of wrapper
> in the backends should be renamed _wrapper.

With the suggested scheme over, it will still be a legal attribute
(simply proxy.wrapper) but would not be put in proxy.state.

> regards.

-- 
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org


-------------------------------------------------------
In remembrance
www.osdn.com/911/
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.