140
138
ctx.rectangle(bg_area.x, bg_area.y, bg_area.width, bg_area.height)
141
ctx.set_line_width(2)
142
ctx.set_line_cap(cairo.LINE_CAP_SQUARE)
143
144
box_size = self.box_size(widget)
145
ctx.set_line_width(box_size / 8)
146
ctx.set_line_cap(cairo.LINE_CAP_ROUND)
148
146
# Draw lines into the cell
149
147
for start, end, colour in self.in_lines:
150
self.render_line (ctx, cell_area, box_size,
151
bg_area.y, bg_area.height,
148
ctx.move_to(cell_area.x + box_size * start + box_size / 2,
149
bg_area.y - bg_area.height / 2)
152
ctx.line_to(cell_area.x + box_size * start, bg_area.y)
153
ctx.line_to(cell_area.x + box_size * end + box_size, bg_area.y)
154
elif start - end < -1:
155
ctx.line_to(cell_area.x + box_size * start + box_size,
157
ctx.line_to(cell_area.x + box_size * end, bg_area.y)
159
ctx.line_to(cell_area.x + box_size * end + box_size / 2,
160
bg_area.y + bg_area.height / 2)
162
self.set_colour(ctx, colour, 0.0, 0.65)
154
165
# Draw lines out of the cell
155
166
for start, end, colour in self.out_lines:
156
self.render_line (ctx, cell_area, box_size,
157
bg_area.y + bg_area.height, bg_area.height,
167
ctx.move_to(cell_area.x + box_size * start + box_size / 2,
168
bg_area.y + bg_area.height / 2)
171
ctx.line_to(cell_area.x + box_size * start,
172
bg_area.y + bg_area.height)
173
ctx.line_to(cell_area.x + box_size * end + box_size,
174
bg_area.y + bg_area.height)
175
elif start - end < -1:
176
ctx.line_to(cell_area.x + box_size * start + box_size,
177
bg_area.y + bg_area.height)
178
ctx.line_to(cell_area.x + box_size * end,
179
bg_area.y + bg_area.height)
181
ctx.line_to(cell_area.x + box_size * end + box_size / 2,
182
bg_area.y + bg_area.height / 2 + bg_area.height)
184
self.set_colour(ctx, colour, 0.0, 0.65)
160
187
# Draw the revision node in the right column
161
188
(column, colour) = self.node
162
189
ctx.arc(cell_area.x + box_size * column + box_size / 2,
163
190
cell_area.y + cell_area.height / 2,
164
box_size / 4, 0, 2 * math.pi)
191
box_size / 5, 0, 2 * math.pi)
166
193
self.set_colour(ctx, colour, 0.0, 0.5)
167
194
ctx.stroke_preserve()
169
196
self.set_colour(ctx, colour, 0.5, 1.0)
172
def render_line (self, ctx, cell_area, box_size, mid, height, start, end, colour):
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)
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)
203
self.set_colour(ctx, colour, 0.0, 0.65)
b'\\ No newline at end of file'