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

metaclass conflict calling Gdk.Display.get_default() #19

Open garyvdm opened 9 years ago

garyvdm commented 9 years ago

When I run Gdk.Display.get_default() I get a TypeError: metaclass conflict:

>>> from pgi.repository import Gdk
>>> Gdk.Display.get_default()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 10, in get_default
  File "/home/garyvdm/dev/welkom/ve/lib/python3.4/site-packages/pgi/codegen/ctypes_backend/types_interface.py", line 99, in get_class_func
    pytype = gtype.pytype
  File "/home/garyvdm/dev/welkom/ve/lib/python3.4/site-packages/pgi/util.py", line 281, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/home/garyvdm/dev/welkom/ve/lib/python3.4/site-packages/pgi/gtype.py", line 123, in pytype
    cls = new_class_from_gtype(self)
  File "/home/garyvdm/dev/welkom/ve/lib/python3.4/site-packages/pgi/obj.py", line 386, in new_class_from_gtype
    cls = type(gtype.name, bases, dict(_Object.__dict__))
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Julian commented 8 years ago

+1, same here.

I'm random shotgun coding to see if I can get the app I want to run, but in doing so it seems likely that Object.__cmp__ should be removed, and Object.__eq__ needs a if not isinstance(other, self.__class__): return NotImplemented, otherwise that line continues to fail even after I filter out the NoneType (which I have no idea is the right thing to do there but gets me further) (http://characteristic.readthedocs.org/en/stable/ is a nice thing).

lazka commented 8 years ago

While the underlying problem probably isn't fixed it works in master (I think due to auto importing of GdkX11) and I've pushed a new release.