Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#2743 closed defect (fixed)

handle the case of a activity without metadata

Reported by: godiard Owned by: erikos
Priority: Unspecified by Maintainer Milestone:
Component: Sugar Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed


Test case:

Download Hello World activity.

Install it, the activity starts ok.

Modify the line:

activity.Activity.init(self, handle)


activity.Activity.init(self, handle, False)

The activity does not start.

Attachments (1)

0001-The-activity-icon-does-not-handle-the-case-of-a-acti.patch (970 bytes) - added by godiard 13 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 13 years ago 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/ b/src/sugar/activity/
index 7166d3e..2331532 100644
--- a/src/sugar/activity/
+++ b/src/sugar/activity/
@@ -56,8 +56,12 @@ class ActivityButton(ToolButton):
-        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>
  File "/home/erikos/sugar-jhbuild/install/lib/python2.7/site-packages/sugar/activity/", line 158, in main
    create_activity_instance(activity_constructor, activity_handle)
  File "/home/erikos/sugar-jhbuild/install/lib/python2.7/site-packages/sugar/activity/", line 37, in create_activity_instance
    activity = constructor(handle)
  File "/home/erikos/Activities/HelloWorld.activity/", line 51, in __init__
    title_entry = TitleEntry(self)
  File "/home/erikos/sugar-jhbuild/install/lib/python2.7/site-packages/sugar/activity/", line 197, in __init__
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.

comment:2 Changed 13 years ago by erikos

  • Summary changed from The activity icon does not handle the case of a activity without metadata. to handle the case of a activity without metadata

comment:3 Changed 13 years ago by erikos

  • Keywords 11.2.0 removed

comment:4 Changed 11 years ago by dnarvaez

  • Component changed from sugar-toolkit to Sugar

comment:5 Changed 11 years ago by dnarvaez

  • Resolution set to fixed
  • Status changed from new to closed

Seems fixed

comment:6 Changed 11 years ago by dnarvaez

  • Milestone 0.92 deleted

Milestone 0.92 deleted

Note: See TracTickets for help on using tickets.