@@ -63,32 +63,30 @@ def set_drawing_area(self, da):
63
63
64
64
def get_color (self , rgb ):
65
65
"""
66
- RGB is a unit RGB tuple, return a gtk.gdk.Color
66
+ Take an RGB ( a unit RGB tuple) and return a allocated gtk.gdk.Color
67
67
"""
68
+ try :
69
+ return self ._cached [tuple (rgb )]
70
+ except KeyError :
71
+ if self ._cmap is None :
72
+ raise RuntimeError ('First set the drawing area!' )
68
73
69
- try : return self ._cached [tuple (rgb )]
70
- except KeyError : pass
71
-
72
- if self ._cmap is None :
73
- raise RuntimeError ('First set the drawing area!' )
74
-
75
- #print 'rgb is', rgb
76
- r ,g ,b = rgb
77
- color = self ._cmap .alloc_color (int (r * 65025 ),int (g * 65025 ),int (b * 65025 ))
78
- self ._cached [tuple (rgb )] = color
79
- return color
74
+ r ,g ,b = rgb
75
+ color = self ._cmap .alloc_color (
76
+ int (r * 65025 ),int (g * 65025 ),int (b * 65025 ))
77
+ self ._cached [tuple (rgb )] = color
78
+ return color
80
79
81
80
def get_rgb (self , color ):
82
81
"""
83
- RGB is a unit RGB tuple, return a gtk.gdk.Color
82
+ Take a gtk.gdk.Color and return an RGB (a unit RGB tuple)
84
83
"""
85
-
86
84
return [val / 65535 for val in (color .red , color .green , color .blue )]
87
85
88
86
colorManager = ColorManagerGTK ()
89
87
90
- class RendererGTK (RendererBase ):
91
88
89
+ class RendererGTK (RendererBase ):
92
90
fontweights = {
93
91
100 : pango .WEIGHT_ULTRALIGHT ,
94
92
200 : pango .WEIGHT_LIGHT ,
0 commit comments