Sugar.activity.registry

From OLPC
Revision as of 13:58, 30 June 2008 by Fanwar (talk | contribs) (New page: = ActivityRegistry = The ActivityRegistry class can be used to help you get information about the activities that are installed on the current XO. === How do I get a list of all the acti...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ActivityRegistry

The ActivityRegistry class can be used to help you get information about the activities that are installed on the current XO.

How do I get a list of all the activities that are available on an XO?

Use the get_activities() method in ActivityRegistry. This will return a list of ActivityInfo objects - one for each activity installed. You can then iterate through this list.

from sugar.activity import registry
...
       print '********************************** ACTIVITY REGISTRY **********************************'
        ar = registry.ActivityRegistry()

        # use get_activities() to get a list of ActivityInfo objects and iterate through each
        for ai in ar.get_activities():
            print ai.name