Development Team/Almanac/sugar.activity.activity: Difference between revisions

m Robot: Automated text replacement (-{{Sugar Almanac TOC}} +{{Almanac TOC}})
 
(9 intermediate revisions by 6 users not shown)
Line 215: 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? ===