diff options
author | Manuel QuiƱones <manuq@laptop.org> | 2012-08-10 12:57:54 (GMT) |
---|---|---|
committer | Manuel QuiƱones <manuq@laptop.org> | 2012-08-10 12:57:54 (GMT) |
commit | 236cb770b816cf15fac880b79d24b48509ec4183 (patch) | |
tree | 8d228df737b62165d3980407780090881b65759c | |
parent | 041b6afb1aa1605f08485896e366ba9cf8ed40f1 (diff) |
Port of the CellRendererIcon
The destroy signal workaround is still there.
-rw-r--r-- | src/sugar3/graphics/icon.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py index 94cf558..c602121 100644 --- a/src/sugar3/graphics/icon.py +++ b/src/sugar3/graphics/icon.py @@ -780,7 +780,7 @@ class CellRendererIcon(Gtk.CellRenderer): size = GObject.property(type=object, setter=set_size) - def on_get_size(self, widget, cell_area): + def do_get_size(self, widget, cell_area): width = self._buffer.width + self.props.xpad * 2 height = self._buffer.height + self.props.ypad * 2 xoffset = 0 @@ -798,11 +798,11 @@ class CellRendererIcon(Gtk.CellRenderer): return xoffset, yoffset, width, height - def on_activate(self, event, widget, path, background_area, cell_area, + def do_activate(self, event, widget, path, background_area, cell_area, flags): pass - def on_start_editing(self, event, widget, path, background_area, cell_area, + def do_start_editing(self, event, widget, path, background_area, cell_area, flags): pass @@ -824,8 +824,7 @@ class CellRendererIcon(Gtk.CellRenderer): return False - def on_render(self, window, widget, background_area, cell_area, - expose_area, flags): + def do_render(self, cr, widget, background_area, cell_area, flags): if self._xo_color is not None: stroke_color = self._xo_color.get_stroke_color() fill_color = self._xo_color.get_fill_color() @@ -840,7 +839,7 @@ class CellRendererIcon(Gtk.CellRenderer): has_prelit_colors = None not in [prelit_fill_color, prelit_stroke_color] - if flags & Gtk.CELL_RENDERER_PRELIT and has_prelit_colors and \ + if flags & Gtk.CellRendererState.PRELIT and has_prelit_colors and \ self._is_prelit(widget): self._buffer.fill_color = prelit_fill_color @@ -853,14 +852,14 @@ class CellRendererIcon(Gtk.CellRenderer): if surface is None: return - xoffset, yoffset, width_, height_ = self.on_get_size(widget, cell_area) + xoffset, yoffset, width_, height_ = self.do_get_size(widget, cell_area) x = cell_area.x + xoffset y = cell_area.y + yoffset - cr = window.cairo_create() cr.set_source_surface(surface, math.floor(x), math.floor(y)) - cr.rectangle(expose_area) + # FIXME no expose_area, maybe use cell_area? + # cr.rectangle(expose_area) cr.paint() |