[Sugar-devel] Problem with Log activity - Sugar widgets

Walter Bender walter.bender at gmail.com
Fri Mar 2 16:02:05 EST 2012


On Fri, Mar 2, 2012 at 3:42 PM, Alan Jhonn Aguiar Schwyn
<alanjas at hotmail.com> wrote:
>
> Hi,
>
> Some time ago I make this ticket:
>
> http://bugs.sugarlabs.org/ticket/3328
>
> The problem is:
>
> 3 Traceback (most recent call last):
> 4  File "/usr/bin/sugar-activity", line 21, in <module>
> 5    main.main()
> 6  File "/usr/lib/python2.6/site-packages/sugar/activity/main.py", line 152,
> in main
> 7    create_activity_instance(activity_constructor, activity_handle)
> 8  File "/usr/lib/python2.6/site-packages/sugar/activity/main.py", line 37,
> in create_activity_instance
> 9    activity = constructor(handle)
> 10  File "/home/olpc/Activities/Log.activity/logviewer.py", line 363, in
> __init__
> 11    self._build_toolbox()
> 12  File "/home/olpc/Activities/Log.activity/logviewer.py", line 372, in
> _build_toolbox
> 13    activity_button = ActivityToolbarButton(self)
> 14  File "/usr/lib/python2.6/site-packages/sugar/activity/widgets.py", line
> 74, in __init__
> 15    icon = _create_activity_icon(activity.metadata)
> 16  File "/usr/lib/python2.6/site-packages/sugar/activity/widgets.py", line
> 37, in _create_activity_icon
> 17    if metadata.get('icon-color', ''):
> 18 AttributeError: 'NoneType' object has no attribute 'get'
>
> I think this: If is the first time that you open the activity, the metadata
> is None...
>
> How nobody solve it, I propose this  QUICK SOLUTION:
>
> in the file  "/usr/lib/python2.6/site-packages/sugar/activity/widgets.py" :
>
> with the "short circuit if":
>
>     if metadata and metadata.get('icon-color', ''):

Maybe better to test for 'icon-color' in metadata...

-walter

>             color = XoColor(metadata['icon-color'])
>     else:
>         client = gconf.client_get_default()
>         color = XoColor(client.get_string('/desktop/sugar/user/color'))
>
> This problem can solve some error in others activities...
>
> What are your opinions?
>
> Regards!
>
> Alan
>
>
>
>
>
>
>
>
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list