6656: division on hexadecimalcolor

svn: r22145
This commit is contained in:
Jérôme Rapinat 2013-05-02 17:22:16 +00:00
parent 2cec980066
commit 022ff28d94

View File

@ -475,7 +475,7 @@ def hex_to_rgb_float(value):
def hex_to_rgb(value): def hex_to_rgb(value):
""" """
Convert a hexademical value #FF00FF to rgb. Returns tuple of integers Convert a hexadecimal value #FF00FF to rgb. Returns tuple of integers
""" """
value = value.lstrip('#') value = value.lstrip('#')
lenv = len(value) lenv = len(value)
@ -495,7 +495,7 @@ def color_to_hex(color):
"""Convert Gdk.Color to hex string.""" """Convert Gdk.Color to hex string."""
hexstring = "" hexstring = ""
for col in 'red', 'green', 'blue': for col in 'red', 'green', 'blue':
hexfrag = hex(getattr(color, col) / (16 * 16)).split("x")[1] hexfrag = hex(getattr(color, col) // (16 * 16)).split("x")[1]
if len(hexfrag) < 2: if len(hexfrag) < 2:
hexfrag = "0" + hexfrag hexfrag = "0" + hexfrag
hexstring += hexfrag hexstring += hexfrag