[Sugar-devel] [PATCH Sugar-toolkit-gtk3] ActivityButton should handle the case of activities without metadata

Manuel Quiñones manuq at laptop.org
Mon May 14 15:11:34 EDT 2012


I tested making this change in Browse:

 class WebActivity(activity.Activity):
     def __init__(self, handle):
-        activity.Activity.__init__(self, handle)
+        activity.Activity.__init__(self, handle, False)

The activity does not start, and then if I apply the patch of Gonzalo, it does.

2012/5/14  <godiard at sugarlabs.org>:
> From: Gonzalo Odiard <godiard at gmail.com>
>
> We already manage this cae in the icon creation but not when we set
> the button tooltip
>
> Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>

Tested-by: Manuel Quiñones <manuq at laptop.org>
>
> -------------------
>
> v2: Improve description.
>    Do not try to connect the 'updated' signal.
> ---
>  src/sugar3/activity/widgets.py |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py
> index 97450f2..c7683cf 100644
> --- a/src/sugar3/activity/widgets.py
> +++ b/src/sugar3/activity/widgets.py
> @@ -60,8 +60,9 @@ class ActivityButton(ToolButton):
>         self.set_icon_widget(icon)
>         icon.show()
>
> -        self.props.tooltip = activity.metadata['title']
> -        activity.metadata.connect('updated', self.__jobject_updated_cb)
> +        if activity.metadata:
> +            self.props.tooltip = activity.metadata['title']
> +            activity.metadata.connect('updated', self.__jobject_updated_cb)
>
>     def __jobject_updated_cb(self, jobject):
>         self.props.tooltip = jobject['title']
> --
> 1.7.10.1
>
> _______________________________________________
> 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