[wxPython-users] A module to help load frame and dialog from XRC resource easily.

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon Jan 14 08:00:31 PST 2008


Aaron, 

> -----Original Message-----
> From: Aaron Brady [mailto:castironpi at comcast.net] 
> Sent: Sunday, January 13, 2008 8:57 PM
> To: wxPython-users at lists.wxwidgets.org
> Subject: RE: [wxPython-users] A module to help load frame and 
> dialog from XRC resource easily.
> 
> Python 2.5.  How does self.__dict__ work in __getattribute__?
> 
>  
> 
> __getattribute__(
> 
> self, name)
> 
> Called unconditionally to implement attribute accesses for 
> instances of the class. If the class also defines 
> __getattr__(), the latter will not be called unless 
> __getattribute__() either calls it explicitly or raises an 
> AttributeError. 
> 
> __getattr__(
> 
> self, name)
> 
> Called when an attribute lookup has not found the attribute 
> in the usual places (i.e. it is not an instance attribute nor 
> is it found in the class tree for self). name is the 
> attribute name. This method should return the (computed) 
> attribute value or raise an AttributeError exception. 
> 
>  
>


I'm a little confused with this whole thread. I didn't think that using
the "magic" methods (or metaclasses) was a recommended Python programming
practice. While it might be elegant to the person programming it, to less
proficient programmers, it looks confusing. Maybe I'm just being nitpicky
though. Aren't there some standard "setters" and "getters" ?

Mike

 
>  
> 
> ________________________________
> 
> From: Gary Lee [mailto:garywlee at gmail.com]
> Sent: Sunday, January 13, 2008 8:53 PM
> To: wxPython-users at lists.wxwidgets.org
> Subject: Re: [wxPython-users] A module to help load frame and 
> dialog from XRC resource easily.
> 
>  
> 
> 2008/1/13, Eli Golovinsky <gooli at testuff.com>:
> 
> 	Your __getattr__implementation in XrcFrame seems to 
> assume there are
> 	no other attributes in a frame other than the control 
> it holds. That
> 	isn't always true and the implementation should first 
> look for the
> 	attribute in __dict__ and only the do an XRCCTRL call. 
> 
> 
> Isn't __getattr__ called when the given attribute name can't 
> be found in a object, is it? So, the XRCCTRL call will be 
> called only when the given attribute not found in __dict__. I 
> added the object loaded by XRCCTRL to __dict__. Therefore, it 
> won't be loaded again. 
> 
> 	 
> 
> 	Another note on this: in order to make this module 
> generally useful,
> 	you'll need to add support for handling menus and 
> toolbars as well. 
> 
> 
>  Thanks for your suggestions. I am looking for a way to 
> support menu and toolbars. However, I never use Menu and 
> Toolbar from XRC resource before. Still have no idea. Any cool idea?
> 
> 
> 
>  
> 
> 




More information about the wxpython-users mailing list