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

Allow tuple creation #35

Closed tobes closed 8 years ago

tobes commented 8 years ago

Hi,

I've been playing trying to get pydbus to work with pgi (currently it is hardcoded to work with python-gi). So far I can get it working as far as connecting to dbus objects and getting their properties/methods. My next task is to try to get subscriptions fully working I seem to be having the odd seg fault etc. Part of my reason for doing this is to allow better testing inside tox as python-gi is unavailable.

This PR adds tuple support so we can now do GLib.Variant('(si), ('foo', 42)) I'm sure that it could be done better but I have managed to get it working well enough to achieve some success.

I've found it quite complex especially the Wrapping which I still haven't quite got my head round. _CONTAINER_CONSTRUCTORS allowed me to have an unwrapped creator. Other approaches such as using VariantBuilder had issues due to the wrapping.

As you can see in pgi/codegen/ctypes_backend/types_interface.py I've had to disable type checking this is to allow Glib.VariantType to pass the test as I get <Variant structure at 0x7f7448f28150 (GVariant at 0x7f743c005060)> is not a structure object due to the wrapping. Is there a better way of preventing GLib objects being wrapped like this as it caused me many problems.

LEW21 commented 8 years ago

Hi, I've fixed all (I think) GVariant-related problems in https://github.com/lazka/pgi/pull/36.

lazka commented 8 years ago

If possible don't try to fix things through changes in overrides, they are copied from pygobject and that makes it hard to keep them in sync. Instead try to fix the internal APIs/behavior to match pygobject.