[Sugar-devel] [PATCH sugar-toolkit-gtk3] Finish the port of the CellRendererIcon

Manuel Quiñones manuq at laptop.org
Tue Sep 4 08:11:46 EDT 2012


2012/9/3 Simon Schampijer <simon at schampijer.de>:
> On 08/24/2012 03:13 PM, Manuel Quiñones wrote:
>>
>> 2012/8/24 Simon Schampijer <simon at schampijer.de>:
>>>
>>> On 08/23/2012 08:16 PM, Manuel Quiñones wrote:
>>>>
>>>>
>>>> In pygtk custom cellrenderers were done inheriting
>>>> gtk.GenericCellRenderer, and overriding the on_* methods.  Now we
>>>> inherit Gtk.CellRenderer and the methods to override changed to do_* .
>>>>
>>>> The destroy signal was moved to Gtk.Widget [1] so the Gtk.CellRenderer
>>>> doesn't have it anymore.  Now we do the cleanup in the python
>>>> destructor method.  A testcase tests/graphics/customdestroy.py shows
>>>> how is done.
>>>>
>>>> tests/graphics/cellrenderericon.py tests the usage.
>>>>
>>>> Signed-off-by: Manuel Quiñones <manuq at laptop.org>
>>>
>>>
>>>
>>> Great, thanks for adding as well a testcase:
>>>
>>> I get one traceback when hovering over a cell:
>>>
>>> Traceback (most recent call last):
>>>    File
>>>
>>> "/home/erikos/sugar-build/install/lib/python2.7/site-packages/sugar3/graphics/palettewindow.py",
>>> line 1199, in __motion_notify_event_cb
>>>      if self._point_in_cell_renderer(event.x, event.y):
>>>    File
>>>
>>> "/home/erikos/sugar-build/install/lib/python2.7/site-packages/sugar3/graphics/palettewindow.py",
>>> line 1258, in _point_in_cell_renderer
>>>      for cell_renderer in column.get_cell_renderers():
>>> AttributeError: 'TreeViewColumn' object has no attribute
>>> 'get_cell_renderers'
>>>
>>> Do you get that as well?
>>
>>
>> Yes.  I was thinking in a separate patch for the palettewindow, but
>> what do you think?  Is better to do it in this one?
>>
>> The issue is for the API change, column.get_cell_renderers now is
>> column.get_cells .
>
>
> Ok, let's do in a separate patch, something like this would do:

Yes, I have tested and those two changes fix the issue.  I'm attaching
a patch for current master.  Please push if you are ok with it.

> diff --git a/src/sugar3/graphics/palettewindow.py
> b/src/sugar3/graphics/palettewindow.py
> index 2c8816c..1307a20 100644
> --- a/src/sugar3/graphics/palettewindow.py
> +++ b/src/sugar3/graphics/palettewindow.py
> @@ -1221,7 +1221,7 @@ class CellRendererInvoker(Invoker):
>      def _redraw_path(self, path):
>          column = None
>          for column in self._tree_view.get_columns():
> -            if self._cell_renderer in column.get_cell_renderers():
> +            if self._cell_renderer in column.get_cells():
>                  break
>          assert column is not None
>          area = self._tree_view.get_background_area(path, column)
> @@ -1255,7 +1255,7 @@ class CellRendererInvoker(Invoker):
>
>          path_, column, x, y_ = pos
>
>
> -        for cell_renderer in column.get_cell_renderers():
> +        for cell_renderer in column.get_cells():
>              if cell_renderer == self._cell_renderer:
>
>                  cell_x, cell_width =
> column.cell_get_position(cell_renderer)
>                  if x > cell_x and x < (cell_x + cell_width):
>
> But should be verified.
>
> I pushed your patch in the meantime.
>
> Thanks,
>    Simon
>



-- 
.. manuq ..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-calls-to-Gtk.TreeViewColumn-get_cells-in-the-pal.patch
Type: application/octet-stream
Size: 1642 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120904/05f15661/attachment-0001.obj>


More information about the Sugar-devel mailing list