Changes

Jump to navigation Jump to search
m
Line 213: Line 213:  
         if tb.get_active():
 
         if tb.get_active():
 
             self.invite(buddy_key)
 
             self.invite(buddy_key)
 +
</pre>
 +
 +
=== 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>
 
</pre>
  

Navigation menu