[pygtk] Glade XML wrapper and easy callbacks
sridharinfinity at gmail.com
Thu Aug 5 20:09:05 WST 2004
Graham Ashton <gashton at cmedltd.com> wrote:
> On Thu, 2004-08-05 at 06:23, Sridhar R wrote:
> > Graham Ashton <gashton at cmedltd.com> wrote:
> > > On Wed, 2004-08-04 at 01:40, Sridhar R wrote:
> > > > Graham Ashton <graham at effectif.com> wrote:
> > > >
> > > > > If anybody wants a really simple implementation to this kind of wrapper
> > > > > class feel free to rip off the WidgetWrapper class hierarchy that I've
> > > > > knocked up here (it's tiny):
> > > > >
> > > > > http://cvs.sourceforge.net/viewcvs.py/bandsaw/bandsaw/src/bandsaw.py?view=markup
> > > >
> > > > But the signal connection part is a little bit weak. How do you
> > > > connect signals to some deeply nested widgets in that hierarchy?
> > >
> > > What do you mean by deeply nested?
> > child of child of .. the toplevel widget. (may be wrong terminology).
> Thanks. I don't understand why you think it doesn't work.
> signal_autoconnect() does the nested widgets for you. Or am I missing
> the point?
Sorry, now I understand it correctly
def connect_signals(self, obj):
for name in obj.__class__.__dict__.keys():
if hasattr(obj, name):
candidate_callback = getattr(obj, name)
So you *manually* enter the handler name for each widget in glade
signal editor right? That's a bit inconvinient, if you want to add
another callback, say--Add callback in glade signal editor and define
the method in code. GWidget  automates this.
(I need to make some changes to that code based on the feedback I get
here--that'll be in my next python project)
 see the Original Post
Sridhar - http://www.cs.annauniv.edu/~rsridhar
More information about the pygtk