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 675579 - Gdk Color override should support red/green/blue_float properties
Gdk Color override should support red/green/blue_float properties
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-05-06 22:35 UTC by Simon Feltman
Modified: 2012-06-05 08:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Gdk Color override should support red/green/blue_float properties (3.92 KB, patch)
2012-05-12 20:49 UTC, Simon Feltman
none Details | Review
Proper version with __iter__ (4.57 KB, patch)
2012-05-12 20:51 UTC, Simon Feltman
none Details | Review

Description Simon Feltman 2012-05-06 22:35:23 UTC
PyGtk/Gdk used to have properties for accessing RGB values on Color objects as individual floats. When working with colors in the gnome stack things can get tricky due to libs having different implementations of a color object (Gtk/Gdk, Clutter, Cairo, Cogl). With Gtk it can be particularly odd to have client code which hard codes things like "color.red / 65535.0" in order to use it with another gnome library. While I understand these libs have potentially different requirements or even need to maintain independence from glib, converting to/from the different libs and color objects should be easier. The float accessors definitely helped this as it allowed client code to be written without having to know implementation detail. Furthermore, it would be nice if there were methods on the color classes which allowed for direct conversion to one another.
Comment 1 Simon Feltman 2012-05-12 20:49:21 UTC
Created attachment 213935 [details] [review]
Gdk Color override should support red/green/blue_float properties

Added red_float, green_float, and blue_float properties to Color.
Also added Color.from_floats, RGBA.to_color, and RGBA.from_color.
Comment 2 Simon Feltman 2012-05-12 20:51:44 UTC
Created attachment 213936 [details] [review]
Proper version with __iter__
Comment 3 Martin Pitt 2012-05-14 11:15:12 UTC
Thanks! Applied with a few whitespace fixes.
Comment 4 Martin Pitt 2012-06-05 08:39:46 UTC
Forgot to close the bug back then.