30
30
in_lines (start, end, colour) tuple list to draw inward lines,
31
31
out_lines (start, end, colour) tuple list to draw outward lines.
34
36
__gproperties__ = {
35
37
"node": ( gobject.TYPE_PYOBJECT, "node",
96
colour %= len(colours)
97
red = (colours[colour][0] * fg) or bg
98
green = (colours[colour][1] * fg) or bg
99
blue = (colours[colour][2] * fg) or bg
100
colour_rgb = mainline_color
102
colour_rgb = colours[colour % len(colours)]
104
red = (colour_rgb[0] * fg) or bg
105
green = (colour_rgb[1] * fg) or bg
106
blue = (colour_rgb[2] * fg) or bg
101
108
ctx.set_source_rgb(red, green, blue)
110
117
box_size = self.box_size(widget) + 1
113
for start, end, colour in self.in_lines + self.out_lines:
114
cols = max(cols, start, end)
116
width = box_size * (cols + 1)
119
width = box_size * (self.columns_len + 1)
117
120
height = box_size
119
122
# FIXME I have no idea how to use cell_area properly
140
143
box_size = self.box_size(widget)
142
145
ctx.set_line_width(box_size / 8)
143
ctx.set_line_cap(cairo.LINE_CAP_SQUARE)
146
ctx.set_line_cap(cairo.LINE_CAP_ROUND)
145
148
# Draw lines into the cell
146
149
for start, end, colour in self.in_lines:
169
172
def render_line (self, ctx, cell_area, box_size, mid, height, start, end, colour):
170
startx = cell_area.x + box_size * start + box_size / 2
171
endx = cell_area.x + box_size * end + box_size / 2
173
ctx.move_to(startx, mid - height / 2)
175
if start - end == 0 :
176
ctx.line_to(endx, mid + height / 2)
174
x = cell_area.x + box_size * end + box_size / 2
175
ctx.move_to(x, mid + height / 3)
176
ctx.line_to(x, mid + height / 3)
177
ctx.move_to(x, mid + height / 6)
178
ctx.line_to(x, mid + height / 6)
181
x = cell_area.x + box_size * start + box_size / 2
182
ctx.move_to(x, mid - height / 3)
183
ctx.line_to(x, mid - height / 3)
184
ctx.move_to(x, mid - height / 6)
185
ctx.line_to(x, mid - height / 6)
178
ctx.curve_to(startx, mid - height / 5,
179
startx, mid - height / 5,
180
startx + (endx - startx) / 2, mid)
182
ctx.curve_to(endx, mid + height / 5,
183
endx, mid + height / 5 ,
184
endx, mid + height / 2)
187
startx = cell_area.x + box_size * start + box_size / 2
188
endx = cell_area.x + box_size * end + box_size / 2
190
ctx.move_to(startx, mid - height / 2)
192
if start - end == 0 :
193
ctx.line_to(endx, mid + height / 2)
195
ctx.curve_to(startx, mid - height / 5,
196
startx, mid - height / 5,
197
startx + (endx - startx) / 2, mid)
199
ctx.curve_to(endx, mid + height / 5,
200
endx, mid + height / 5 ,
201
endx, mid + height / 2)
186
203
self.set_colour(ctx, colour, 0.0, 0.65)
b'\\ No newline at end of file'