Line 1: |
Line 1: |
− | {{Sugar Almanac}} | + | {{Almanac}} |
− | {{Sugar Almanac TOC}} | + | {{Almanac TOC}} |
| The sugar.activity.activity package includes several important classes that are needed to run a basic activity. | | The sugar.activity.activity package includes several important classes that are needed to run a basic activity. |
| | | |
Line 40: |
Line 40: |
| #print out the name of this activity | | #print out the name of this activity |
| print activity.get_bundle_name() | | print activity.get_bundle_name() |
| + | |
| + | === How do I get the version number of my activity? === |
| + | |
| + | #print out the version number of this activity |
| + | print os.environ['SUGAR_BUNDLE_VERSION'] |
| | | |
| = Class: Activity = | | = Class: Activity = |
Line 210: |
Line 215: |
| </pre> | | </pre> |
| | | |
− | = Class: ActivityToolbox ([[Sugar.graphics.toolbox|Toolbox]])= | + | === How do I know if my activity is being started from the Journal? === |
| + | |
| + | You can check handle.object_id in the constructor of your Activity class: |
| + | |
| + | <pre> |
| + | from sugar.activity import activity |
| + | ... |
| + | class AnnotateActivity(activity.Activity): |
| + | #### Method: __init__, initialize this AnnotateActivity instance |
| + | def __init__(self, handle): |
| + | ... |
| + | if handle.object_id is None: |
| + | print "Activity is started anew (from the home view)" |
| + | else: |
| + | print "Activity is started from the journal and the object id is %s" % handle.object_id |
| + | ... |
| + | </pre> |
| + | |
| + | = Class: ActivityToolbox ([[Development Team/Almanac/sugar.graphics.toolbox|Toolbox]])= |
| | | |
| === What is the standard toolbox needed in most activities and how do I create it? === | | === What is the standard toolbox needed in most activities and how do I create it? === |