[pygtk] suggestion for signal_connect()

James Henstridge james@daa.com.au
Mon, 24 Jul 2000 23:16:46 +0800 (WST)


On Mon, 24 Jul 2000 acano@systec.com wrote:

> Would it be possible to have the actual instance passed in to the
> callback function, instead of a brand new instance?  This would
> make subclassing easier/nicer.  

there are reference loop problems that prevented doing this in the
currently released pygtk.

> 
> The way it is now, you get this behavior:
[snip]
> Will the change to extension classes allow this type of thing?
> I took a look pygtk 0.7.0 and saw the the connect/marshal code
> was the same as older versions of pygtk (don't know if it's going
> to be changed).  

Well, if you play around with pygtk-0.7.0, you should see that it actually
does pass the original python wrapper to signal handlers (in fact, the
same wrapper is used for the lifetime of the GtkObject).  It does this
without circular references.

Due to the timing of gtk+-2.0 (which should be out in a month or two), I
stopped working on the gtk+-1.2 based extension class branch and have
started porting that work to the new gtk+ (by the time I stabilised
and debugged 0.7.0 and ported the gnome stuff to it, gtk+-2.0 would be out
:)

> 
> A way to add this is by adding the object instance to the data
> tuple in _wrap_gtk_signal_connect ().  maybe something like this:
> 
[snip]
> 
> then switch instance and obj in params, etc...
> 
> 
> I didn't submit a patch because I wasn't sure about all the things that
> needed to be changed.
> 
> Is something like this possible?
> 

James.

-- 
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/