Commit 58fc8b9c authored by Alexandru Băluț's avatar Alexandru Băluț

ruler: Clarify what params setCairoColor handles

There are colors and colors, it seems.
Passing Gdk.Color objects is not handled yet.
parent d5e32d0f
......@@ -43,12 +43,14 @@ RULER_BACKGROUND_COLOR = (57, 63, 63)
def setCairoColor(context, color):
if type(color) is tuple:
if type(color) is Gdk.RGBA:
cairo_color = (float(, float(, float(
elif type(color) is tuple:
# Cairo's set_source_rgb function expects values from 0.0 to 1.0
cairo_color = map(lambda x: max(0, min(1, x / 255.0)), color)
context.set_source_rgb(float(, float(, float(
raise Exception("Unexpected color parameter: %s, %s" % (type(color), color))
class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment