Development Team/Almanac/Code Snippets: Difference between revisions

Garycmartin (talk | contribs)
m Bug, gtk.Toolbar takes 0 arguments
Leejc (talk | contribs)
Files: added get_activity_root snippet
Line 75: Line 75:
  from sugar.activity import activity
  from sugar.activity import activity
  bundle_path = activity.get_bundle_path()
  bundle_path = activity.get_bundle_path()
This snippet shows how to get [http://lists.laptop.org/pipermail/devel/2008-March/011799.html a path to an activity's writable directories] (i.e. the SUGAR_ACTIVITY_ROOT environment variable; see also [[Activity_DBus_API#Security | the activity DBus API]]):
class WebActivity(activity.Activity):
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        temp_path = os.path.join(self.get_activity_root(), 'instance')


== Images ==
== Images ==