#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 |
Description
Test case:
Download Hello World activity.
http://activities.sugarlabs.org/es-ES/sugar/addon/4418
Install it, the activity starts ok.
Modify the line:
activity.Activity.init(self, handle)
to
activity.Activity.init(self, handle, False)
The activity does not start.
Attachments (1)
Change History (7)
Changed 12 years ago by godiard
comment:1 Changed 12 years ago by erikos
comment:2 Changed 12 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 12 years ago by erikos
- Keywords 11.2.0 removed
comment:4 Changed 10 years ago by dnarvaez
- Component changed from sugar-toolkit to Sugar
comment:5 Changed 10 years ago by dnarvaez
- Resolution set to fixed
- Status changed from new to closed
Seems fixed
Note: See
TracTickets for help on using
tickets.
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_filesNot sure what would be the best for stateless activities (yet). Let's keep this open for further thoughts.