pygobject / pgi

[Unmaintained: Use PyGObject instead] GTK+ / GObject Introspection Bindings for PyPy.
GNU Lesser General Public License v2.1
74 stars 16 forks source link

Lack of GList type #3

Closed pwaller closed 10 years ago

pwaller commented 11 years ago

It's not currently possible to call functions returning a GList type. I'm tempted to have a go at implementing this, but if you don't hear from me in the very near future assume I haven't.

vincele commented 10 years ago

+1 for me, could you at least elaborate a bit what would be needed to have this working. I can give it a try too if you put me on the right path...

I see that there is some support for GList objects, as seen in returnvalues.py and glib/init.py

pwaller commented 10 years ago

I had a go but didn't get very far. I really need this but don't have time to implement it currently, nor can I see exactly how to do it.

vincele commented 10 years ago

Have you got any answer from pgi's maintainer since then ?

pwaller commented 10 years ago

@vincele, nope.

lazka commented 10 years ago

Sorry, I'm busy with other projects atm.

It's basically:

vincele commented 10 years ago

OK, but this is a little bit terse for me. Could you elaborate a bit ?

For example, explain what is the GList code already present in pgi for ?

And what the points you cited mean in terms of code, f.e. :

not something in depth, but sufficient to let someone with very little knowledge of cffi or ctypes start hacking, and come back with better questions next time ;-)

Thanks

lazka commented 10 years ago

For passing GLists to functions:

The ctypes_backend GList type needs to use other types for packing/unpacking/validation the list values like in CArray. You can borrow high level tests from the pygobject test suite (might be that they are already there but skipped, don't know)

It's a bit of a mess right now for those non basic types... needs refactoring I guess. Any feedback welcome.

Where do you want to use pgi btw?

vincele commented 10 years ago

Thanks a lot. I try to run meld (meld.sf.net) with pypy, to see if the speed will get better. This is mostly for my own curiosity, but could eventually become interesting for upstreaming...

pwaller commented 10 years ago

I want to use it for the Poppler API, e.g. http://people.freedesktop.org/~ajohnson/docs/poppler-glib/PopplerPage.html

GList *             poppler_page_get_text_attributes    (PopplerPage *page);
pwaller commented 10 years ago

Wow, this looks like it works, awesome!