autoconnecting signals with libglade & PyGTK?

I have been learning Python over the past few weeks, so I am by no means an
expert.  My hope is to write a series of articles for, one of
which I would like to demonstrate RAD in Gnome using PyGTK.

With libglade (in C) there is a function to autoconnect signals.  There
doesn't seem to be any explicit function to do this with PyGTK, but, near as
I can tell, this functionality is supposed to happen automatically.

By combing through, I see __setup_sighandlers is called upon
initializtion of a new widget.  For each signal added using glade, it does:

   signame =
   self.__signals[sig.handler] = (sig.get('object',, (), None)
   if sig.get_bool('after', FALSE):
      widget.connect_after(signame, self.__signal_handler, sig.handler)
      widget.connect(signame, self.__signal_handler, sig.handler)

So it connects the signal to an internal function called __signal_handler.
Notice that it adds to some signals dictionary a tuple whose third element
is None.  Now if we jump over to __signal_handler, we see:

   def __signal_handler(self, wid, *args):
      signame = args[-1]
      args = args[:-1]
      objname, data, handler = self.__signals[signame]
      if not handler: return
		[ ... stuff deleted ... ]

It returns if handler isn't defined, and handler is the third element in the
tuple.  This is harcoded to None in __setup_sighandlers.  So, all this code
seems to be written to autoconnect signals, which is what I want to do, but
I can't see how it could work.  Any help would be appreciated.


Unix/Network Administrator
Algoma University College
Sault Ste. Marie, Ontario
Assistant Project Manager:
Personal homepage:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]