/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 branchview/graphcell.py

  • Committer: Curtis Hovey
  • Date: 2011-09-03 16:53:22 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110903165322-i07g6t9btkypiv97
CellRendererGraph renders. There are errors accessing cairo constants.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
            raise AttributeError, "no such property: '%s'" % property.name
67
67
 
68
68
    def do_get_property(self, property):
69
 
        """Set properties from GObject properties."""
 
69
        """Get properties from GObject properties."""
70
70
        if property.name == "node":
71
71
            return self.node
72
72
        elif property.name == "tags":
131
131
 
132
132
        ctx.set_source_rgb(red, green, blue)
133
133
 
134
 
    def activate(event, widget, path, background_area, cell_area, flags):
 
134
    def do_activate(event, widget, path, background_area, cell_area, flags):
135
135
        return True
136
136
 
137
 
    def start_editing(event, widget, path, background_area, cell_area, flags):
 
137
    def do_editing_started(event, widget, path, background_area, cell_area,
 
138
                           flags):
138
139
        return None
139
140
 
140
 
    def get_size(self, widget, cell_area, x_offset, y_offset, width, height):
 
141
    def do_get_size(self, widget, cell_area):
141
142
        """Return the size we need for this cell.
142
143
 
143
144
        Each cell is drawn individually and is only as wide as it needs
152
153
        # FIXME I have no idea how to use cell_area properly
153
154
        return (0, 0, width, height)
154
155
 
155
 
    def render(self, ctx, widget, bg_area, cell_area, flags):
 
156
    def do_render(self, ctx, widget, bg_area, cell_area, flags):
156
157
        """Render an individual cell.
157
158
 
158
159
        Draws the cell contents using cairo, taking care to clip what we
166
167
        instead of a pure diagonal ... this reduces confusion by an
167
168
        incredible amount.
168
169
        """
169
 
        print "rendering"
170
170
        ctx.rectangle(bg_area.x, bg_area.y, bg_area.width, bg_area.height)
171
171
        ctx.clip()
172
172
 
192
192
                cell_area.y + cell_area.height / 2,
193
193
                box_size / 4, 0, 2 * math.pi)
194
194
 
195
 
        if flags & Gtk.CELL_RENDERER_SELECTED:
 
195
        if flags & Gtk.CellRendererState.SELECTED:
196
196
            ctx.set_source_rgb(1.0, 1.0, 1.0)
197
197
            ctx.set_line_width(box_size / 4)
198
198
            ctx.stroke_preserve()
206
206
 
207
207
        self.render_tags(ctx, widget.create_pango_context(), cell_area, box_size)
208
208
 
209
 
    def render_line(self, ctx, cell_area, box_size, mid, height, start, end, colour, flags):
 
209
    def render_line(self, ctx, cell_area, box_size,
 
210
                    mid, height, start, end, colour, flags):
210
211
        if start is None:
211
 
            ctx.set_line_cap(cairo.LINE_CAP_ROUND)
 
212
            #ctx.set_line_cap(cairo.LINE_CAP_ROUND)
212
213
            x = cell_area.x + box_size * end + box_size / 2
213
214
            ctx.move_to(x, mid + height / 3)
214
215
            ctx.line_to(x, mid + height / 3)
216
217
            ctx.line_to(x, mid + height / 6)
217
218
 
218
219
        elif end is None:
219
 
            ctx.set_line_cap(cairo.LINE_CAP_ROUND)
 
220
            #ctx.set_line_cap(cairo.LINE_CAP_ROUND)
220
221
            x = cell_area.x + box_size * start + box_size / 2
221
222
            ctx.move_to(x, mid - height / 3)
222
223
            ctx.line_to(x, mid - height / 3)
224
225
            ctx.line_to(x, mid - height / 6)
225
226
 
226
227
        else:
227
 
            ctx.set_line_cap(cairo.LINE_CAP_BUTT)
 
228
            #ctx.set_line_cap(cairo.LINE_CAP_BUTT)
228
229
            startx = cell_area.x + box_size * start + box_size / 2
229
230
            endx = cell_area.x + box_size * end + box_size / 2
230
231
 
241
242
                             endx, mid + height / 5 ,
242
243
                             endx, mid + height / 2 + 1)
243
244
 
244
 
        if flags & Gtk.CELL_RENDERER_SELECTED:
 
245
        if flags & Gtk.CellRendererState.SELECTED:
245
246
            ctx.set_source_rgb(1.0, 1.0, 1.0)
246
247
            ctx.set_line_width(box_size / 5)
247
248
            ctx.stroke_preserve()
267
268
        width = 0
268
269
 
269
270
        for tag_idx, tag in enumerate(self.tags):
270
 
            tag_layout.set_text(" " + tag + " ")
 
271
            tag_layout.set_text(" " + tag + " ", -1)
271
272
            text_width, text_height = tag_layout.get_pixel_size()
272
273
 
273
274
            x0 = cell_area.x + \