[pitivi] titleeditor: Fix color setting post Python3 port
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] titleeditor: Fix color setting post Python3 port
- Date: Tue, 6 May 2014 13:03:02 +0000 (UTC)
commit 1b7a645d854cccc5f942f943f7688143fe262153
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Mon Apr 14 22:43:38 2014 +0200
titleeditor: Fix color setting post Python3 port
pitivi/titleeditor.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/titleeditor.py b/pitivi/titleeditor.py
index 6e0a6ed..195fb6d 100644
--- a/pitivi/titleeditor.py
+++ b/pitivi/titleeditor.py
@@ -427,11 +427,13 @@ class PangoBuffer(Gtk.TextBuffer):
return Gdk.Color(pc.red, pc.green, pc.blue)
def color_to_hex(self, color):
+ """
+ @type color: L{Gdk.Color}
+ """
hexstring = ""
for col in 'red', 'green', 'blue':
- hexfrag = hex(getattr(color, col) / (16 * 16)).split("x")[1]
- if len(hexfrag) < 2:
- hexfrag = "0" + hexfrag
+ channel = int(getattr(color, col))
+ hexfrag = "%02x" % (channel / 256)
hexstring += hexfrag
return hexstring
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]