[pygtk] GPollFD/GSource wrappers [was: Re: iosource]

Martin Schulze martin-ml at hippogriff.de
Tue Jun 30 05:37:15 WST 2009


I've got it working!

gobject.Source is not functional - you must derive your own class and
define the functions prepare, check and dispatch. See attached example.

If this is actually intended, the error that's being raised should be a
NotImplementedError. Btw, there doesn't seem to be any documentation
around for the GSource/GPollFD wrappers. (Who cares, as long as it works
- and pygobject/pygtk really rocks ;-) )

Regards,

  Martin




Am Montag, den 29.06.2009, 22:59 +0200 schrieb Martin Schulze:
> Sorry, it should read the "GSource/GPollFD wrappers", not "GIOSource
> wrapper". Also, I should add that I'm using the Linux versions
> 2.16.1/2.14.1 and the Windows versions 2.14.2/2.12.1 of pygobject/pygtk.
> 
> Still, the problem remains unchanged ...
> 
> Regards,
> 
>   Martin
> 
> 
> 
> Am Sonntag, den 28.06.2009, 23:33 +0200 schrieb Martin Schulze:
> > Hello,
> > 
> > I have a problem with the GIOSource wrapper. In the attached test
> > program I'm using either
> > 
> >     a) gobject.io_add_watch() or
> > 
> >     b) gobject.iosource.add_poll_fd() and gobject.iosource.attach()
> > 
> > to listen on a pipe in the glib main context with the following result:
> > 
> >     a) works like a charm (see the dialog being updated every second).
> > 
> >     b) just produces the endlessly repeated error output
> > 
> >         AttributeError: prepare
> >         AttributeError: check
> > 
> > Use "use_poll_fd={False/True}" to switch between a) and b).
> > Can someone guess what's going wrong?
> > 
> > Best Regards,
> > 
> >   Martin
> > 
> > 
> > P.S.: Background: version b) helps me to port the program to win32. I
> > have already implemented an overlapping i/o version of
> > _multiprocessing.PipeConnection (in python using pywin32). I just need
> > to hook the win32 event handle into the glib main context like in
> > version b) of attached code ...
> > 
> > _______________________________________________
> > pygtk mailing list   pygtk at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://faq.pygtk.org/
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 3278 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090629/2fc012e8/attachment.py 


More information about the pygtk mailing list