/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to viz/graphcell.py

  • Committer: Mateusz Korniak
  • Date: 2007-09-02 15:42:18 UTC
  • mto: This revision was merged to the branch mainline in revision 274.
  • Revision ID: matkor@laptop-hp-20070902154218-nba0woaqjsn20f9n
Ignoring eric3 project files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
1
# -*- coding: UTF-8 -*-
3
2
"""Cell renderer for directed graph.
4
3
 
72
71
            metrics = pango_ctx.get_metrics(font_desc)
73
72
 
74
73
            ascent = pango.PIXELS(metrics.get_ascent())
75
 
            descent = pango.PIXELS(metrics.get_ascent())
 
74
            descent = pango.PIXELS(metrics.get_descent())
76
75
 
77
 
            self._box_size = ascent + descent
 
76
            self._box_size = ascent + descent + 6
78
77
            return self._box_size
79
78
 
80
79
    def set_colour(self, ctx, colour, bg, fg):
108
107
        to be, we let the TreeViewColumn take care of making them all
109
108
        line up.
110
109
        """
111
 
        box_size = self.box_size(widget)
 
110
        box_size = self.box_size(widget) + 1
112
111
 
113
112
        cols = self.node[0]
114
113
        for start, end, colour in self.in_lines + self.out_lines:
138
137
        ctx.rectangle(bg_area.x, bg_area.y, bg_area.width, bg_area.height)
139
138
        ctx.clip()
140
139
 
141
 
        ctx.set_line_width(2)
 
140
        box_size = self.box_size(widget)
 
141
 
 
142
        ctx.set_line_width(box_size / 8)
142
143
        ctx.set_line_cap(cairo.LINE_CAP_SQUARE)
143
144
 
144
 
        box_size = self.box_size(widget)
145
 
 
146
145
        # Draw lines into the cell
147
146
        for start, end, colour in self.in_lines:
148
147
            ctx.move_to(cell_area.x + box_size * start + box_size / 2,
188
187
        (column, colour) = self.node
189
188
        ctx.arc(cell_area.x + box_size * column + box_size / 2,
190
189
                cell_area.y + cell_area.height / 2,
191
 
                box_size / 5, 0, 2 * math.pi)
 
190
                box_size / 4, 0, 2 * math.pi)
192
191
 
193
192
        self.set_colour(ctx, colour, 0.0, 0.5)
194
193
        ctx.stroke_preserve()