[Bugs] #2743 UNSP: The activity icon does not handle the case of a activity without metadata.

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Mon Apr 4 17:05:48 EDT 2011


#2743: The activity icon does not handle the case of a activity without metadata.
------------------------------------------+---------------------------------
    Reporter:  godiard                    |          Owner:  erikos     
        Type:  defect                     |         Status:  new        
    Priority:  Unspecified by Maintainer  |      Milestone:  0.92       
   Component:  sugar-toolkit              |        Version:  Unspecified
    Severity:  Unspecified                |       Keywords:  11.2.0     
Status_field:  Unconfirmed                |   Distribution:  Unspecified
   Seeta_dev:                             |  
------------------------------------------+---------------------------------

Comment(by erikos):

 This does fix the issue for the 'ActivityToolbarButton' but the
 'ActivityButton' does still not work when try to create an activity
 without metadata like the example from Gonzalo above.

 I tried to fix the other part with doing:

 {{{
 diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
 index 7166d3e..2331532 100644
 --- a/src/sugar/activity/widgets.py
 +++ b/src/sugar/activity/widgets.py
 @@ -56,8 +56,12 @@ 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 is not None and
 activity.metadata.get('title'):
 +            self.props.tooltip = activity.metadata['title']
 +            activity.metadata.connect('updated',
 self.__jobject_updated_cb)
 +        else:
 +            from sugar.activity.activity import get_bundle_name
 +            self.props.tooltip = _('%s Activity') % get_bundle_name()

      def __jobject_updated_cb(self, jobject):
          self.props.tooltip = jobject['title']
 }}}

 But we keep on failing like:

 {{{
 ** Message: pygobject_register_sinkfunc is deprecated (HippoCanvasBox)
 1301949870.219353 DEBUG root: *** Act
 1f15c84b23d36241183edbe7ade59222e27d5096, mesh instance None, scope
 private
 Traceback (most recent call last):
   File "/home/erikos/sugar-jhbuild/install/bin/sugar-activity", line 21,
 in <module>
     main.main()
   File "/home/erikos/sugar-jhbuild/install/lib/python2.7/site-
 packages/sugar/activity/main.py", line 158, in main
     create_activity_instance(activity_constructor, activity_handle)
   File "/home/erikos/sugar-jhbuild/install/lib/python2.7/site-
 packages/sugar/activity/main.py", line 37, in create_activity_instance
     activity = constructor(handle)
   File "/home/erikos/Activities/HelloWorld.activity/activity.py", line 51,
 in __init__
     title_entry = TitleEntry(self)
   File "/home/erikos/sugar-jhbuild/install/lib/python2.7/site-
 packages/sugar/activity/widgets.py", line 197, in __init__
     self.entry.set_text(activity.metadata['title'])
 TypeError: 'NoneType' object is not subscriptable
 1301949870.236290 DEBUG root: _cleanup_temp_files
 }}}

 Not sure what would be the best for stateless activities (yet). Let's keep
 this open for further thoughts.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/2743#comment:1>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list