After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635947 - Gdk.Cursor needs overriding
Gdk.Cursor needs overriding
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-11-27 20:53 UTC by Paolo Borelli
Modified: 2011-02-16 22:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Cursor: add constructors (3.07 KB, patch)
2010-12-03 02:09 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review
add Gdk.Cursor override (3.05 KB, patch)
2010-12-04 00:42 UTC, johnp
committed Details | Review

Description Paolo Borelli 2010-11-27 20:53:06 UTC
Gdk.Cursor constructor needs overriding, but I am not sure how to implement it...

The old pygtk api allowed the following variants:

    gtk.gdk.Cursor(cursor_type)
    gtk.gdk.Cursor(display, cursor_type)
    gtk.gdk.Cursor(display, pixbuf, x, y)
    gtk.gdk.Cursor(source, mask, fg, bg, x, y)
Comment 1 Johan (not receiving bugmail) Dahlin 2010-12-03 02:09:34 UTC
Created attachment 175754 [details] [review]
Cursor: add constructors

Work in progress, overrides doesn't appear to work for boxed types.
Comment 2 johnp 2010-12-04 00:42:48 UTC
Created attachment 175813 [details] [review]
add Gdk.Cursor override
Comment 3 johnp 2010-12-04 00:44:16 UTC
I was working on the same patch :)

overrides should work for boxed types.  It works for Gdk.Color
Comment 4 johnp 2010-12-04 00:47:45 UTC
Note that you shouldn't need the checks because the new_from_foo GI method should run through the proper checks.  Also there was an issue in my tests in that pixmap doesn't get exported (then again I haven't been following the 3.0 api changes so it might not exist anymore.)
Comment 5 Tomeu Vizoso 2011-01-07 11:47:03 UTC
Review of attachment 175813 [details] [review]:

Thanks, please push with the nitpicks fixed

::: gi/overrides/Gdk.py
@@ +132,3 @@
+        total_len = arg_len + kwd_len
+
+        def _new(cursor_type):

Why the leading underscore?

@@ +144,3 @@
+            return cls.new_from_pixmap(source, mask, fg, bg, x, y)
+
+        _constructor = None

Why the leading underscore?

@@ +154,3 @@
+            _constructor = _new_from_pixmap
+        else:
+            raise ValueError("Wrong number of parameters")

Shouldn't be a TypeError?

::: tests/test_overrides.py
@@ +65,3 @@
+        c = Gdk.Cursor(test_pixmap, 
+                       test_pixmap, 
+                       Gdk.Color(0,0,0), 

missing spaces

@@ +82,3 @@
+
+        
+

too many blank lines?
Comment 6 Ignacio Casal Quinteiro (nacho) 2011-01-19 18:09:01 UTC
Is this really needed now that GdkCursor is an Object?