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 543021 - Python GeglRectangle goodness
Python GeglRectangle goodness
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: pygegl
git master
Other All
: Normal enhancement
: ---
Assigned To: Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2008-07-15 03:03 UTC by Joao S. O. Bueno
Modified: 2011-09-03 18:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing GeglRectangle Wrapper in Python (2.67 KB, patch)
2008-07-15 03:09 UTC, Joao S. O. Bueno
accepted-commit_now Details | Review

Description Joao S. O. Bueno 2008-07-15 03:03:14 UTC
I'd like to keep adding some features to the Python Gegl bindings - and I wouldn't matter if I could do that somewhat loosely up to some Gegl API freeze horizon.

Yosh has set up thigns so that pure python enhancements only have to go into the fifthleg.py file to override the authomatic C bindings.

I plan to add some behavior to bring up Gegl introspection closer to
the python API using this.

For now, I just made a python wrapper for GeglRectangle which,  brings the Rectangle class closer to the level of usability a python coder would expect, and offers a taste of what can be done.  

The idea is slowly get to have nice, self documented, feature full python bindings, unlike most bindings built only with automatic wrappers (gtk+, qt), or made in C only, in which case adding things as simple as accepting different parameters for initializing the class is a PITA.
Comment 1 Joao S. O. Bueno 2008-07-15 03:09:00 UTC
Created attachment 114566 [details] [review]
Patch implementing GeglRectangle Wrapper in Python

the wrapper here implements, besides what is done in the pure C call to GeglRectangle available without it:
- Instantiating a rectangle from a len(4) sequence - not only with four separate paramenters;
- Rectangle __add__ allowing one to add a 2 tuple (creates a new, translated rectangle), or a 4 tuple or rectangle (generating the smallest rectangle contaning both operators)
- A __mul__ method allowing for rectangle scaling with a multplication for a scalar
- A __repr__ method whidh will show the rect. components: handy for people 
using gegl at the python console.
- A __getslice__ providing a handy way to retrieve the 4 rect. components.
Comment 2 Martin Nordholts 2009-06-22 19:43:56 UTC
Doesn't hurt to commit this I guess. You have commit access, right? Or was it you who lost your SSH key?
Comment 3 Jon Nordby 2011-09-03 18:46:37 UTC
Still applies and works, so I committed and pushed it now. Why not.
http://git.gnome.org/browse/gegl/commit/?id=63e03ba259d32cebdd6155d4e9c5d9bc662d0e4b

Note that in the longer term we will be going for GObject Introspection for bindings. See bug #645822