Sugar.activity.registry: Difference between revisions

From OLPC
Jump to navigation Jump to search
(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...)
 
Line 9: Line 9:
from sugar.activity import registry
from sugar.activity import registry
...
...
#Create a new ActivityRegistry object
print '********************************** ACTIVITY REGISTRY **********************************'
ar = registry.ActivityRegistry()
ar = registry.ActivityRegistry()



Revision as of 17:58, 30 June 2008

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
...
        #Create a new ActivityRegistry object
        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