GNOME Bugzilla – Bug 635947
Gdk.Cursor needs overriding
Last modified: 2011-02-16 22:53:44 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)
Created attachment 175754 [details] [review] Cursor: add constructors Work in progress, overrides doesn't appear to work for boxed types.
Created attachment 175813 [details] [review] add Gdk.Cursor override
I was working on the same patch :) overrides should work for boxed types. It works for Gdk.Color
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.)
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?
Is this really needed now that GdkCursor is an Object?