[pygobject] Remove Gdk.Rectangle alias with newer gobject-introspection and GTK+



commit 7a3bb6971f22accd25e987496d377e1879f6e1ba
Author: Christoph Reiter <creiter src gnome org>
Date:   Sat May 30 17:46:54 2015 +0200

    Remove Gdk.Rectangle alias with newer gobject-introspection and GTK+
    
    The new GdkRectangle in the typelib confuses the marshalling code
    as PyGObject uses the Python class from the overrides for marshalling
    to Python but uses the gtype from the typelib to do
    type checking when marshalling from Python.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749625

 gi/overrides/Gdk.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 15f2a0a..3ab5d6d 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -126,10 +126,14 @@ if Gdk._version == '2.0':
     Rectangle = override(Rectangle)
     __all__.append('Rectangle')
 else:
-    from gi.repository import cairo as _cairo
-    Rectangle = _cairo.RectangleInt
-
-    __all__.append('Rectangle')
+    # Newer GTK+/gobject-introspection (3.17.x) include GdkRectangle in the
+    # typelib. See https://bugzilla.gnome.org/show_bug.cgi?id=748832 and
+    # https://bugzilla.gnome.org/show_bug.cgi?id=748833
+    if not hasattr(Gdk, 'Rectangle'):
+        from gi.repository import cairo as _cairo
+        Rectangle = _cairo.RectangleInt
+
+        __all__.append('Rectangle')
 
 if Gdk._version == '2.0':
     class Drawable(Gdk.Drawable):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]