[Sugar-devel] [PATCH sugar] SpreadLayout: do not remove items from the grid if there is none yet, SL #3814
Manuel Quiñones
manuq at laptop.org
Mon Aug 20 11:45:24 EDT 2012
Good fix. I was seeing this issue of not initialized grid in the
shell port too.
2012/8/19 Simon Schampijer <simon at schampijer.de>:
> A grid is added to the ViewContainer when the children
> are allocated, we can not do it earlier because we need to
> pass the allocation details. The allocation happens when
> the children needs to be shown. Therefore if the container
> and it's children have not been shown yet, removing the
> child from the grid would fail.
>
> This patch does check if a grid exists already before trying
> to remove items from it.
>
> Signed-off-by: Simon Schampijer <simon at laptop.org>
Acked-by: Manuel Quiñones <manuq at laptop.org>
> ---
> src/jarabe/desktop/favoriteslayout.py | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
> index 0f63f95..e0ee80e 100644
> --- a/src/jarabe/desktop/favoriteslayout.py
> +++ b/src/jarabe/desktop/favoriteslayout.py
> @@ -150,6 +150,11 @@ class SpreadLayout(ViewLayout):
> ViewLayout.__init__(self)
>
> def remove(self, child):
> + if self._grid is None:
> + # the Grid is created during allocation time, so it might not
> + # exist yet when this method is called, SL #3814
> + return
> +
> if self._grid.is_in_grid(child):
> self._grid.remove(child)
>
> --
> 1.7.11.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
--
.. manuq ..
More information about the Sugar-devel
mailing list