Changes

Jump to navigation Jump to search
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"
 +
        else:
 +
            print "Activity is started from the journal"
 +
        ...
 
</pre>
 
</pre>
  
647

edits

Navigation menu