[sugar] how does an activity connect to the journal?

Bert Freudenberg bert
Thu Feb 28 10:28:04 EST 2008


On Feb 28, 2008, at 15:10 , Paul Fox wrote:

> i wrote:
>> where is the interface between activities and the journal
>> documented?  i'm not coming up with anything concrete when i
>> search the wiki.  (or alternatively, i'm coming up with too much
>> to wade through.)
>
> two people have suggested (offlist, presumably to save me
> embarrassment ;-) that i look more closely at:
>     http://wiki.laptop.org/go/Low-level_Activity_API
>
> certainly this page answers my questions about the X properties that
> are being set in the preload library.
>
> both referrers asked if there were things missing from that page.
> i'll try and comment on what i think could help someone like me.
>
> i do feel like that there could be more of a broad-brush
> overview, something like a "Lifetime of an Activity" section,
> that would describe the interactions of an activity with the
> various other sugar services, from start to finish.  this would
> put the various piece parts of the api in context.  i've looked
> (mostly via backlinks from this page) for such an overview, but
> haven't found it.

Good point. I added an attempt to explain the life cycle of an  
activity to the "Overview" section.

> maybe much of what i need is there and i'm just not seeing it.
> i get more from the wiki pages every time i read them, and i'm
> handicapped by not being a python guy -- remember that i'm
> porting an existing non-python, non-DBUS-aware app, and just
> trying to make it run the best it can.  but i also think it's
> typical of a wiki that it concentrate on the details.

That page is actually written by a "non-python guy" for fellow "non- 
python guys". It only uses pseudo-code (although that pseudo-code is  
inspired by Python).

> the "Dbus Methods" section starts with "An activity instance
> needs to create a DBus service", but there's no indication of
> "why?".  what specific user or system interactions will be
> enabled by creating this service?  what specific things won't
> work if i don't?  (also, a link to somehere describing how to
> [figure out how to] create this service for non-python activities
> might be useful here.)

The Sugar shell will (try to) call the methods listed in that  
section. The rationale for each method is given there, too.

>> my activity starts (and terminates) okay, and anything it emits
>> on stdout or stderr ends up in a log file under /home/olpc/.sugar
>> (so some things are working), and it appears on the "ring of
>> running apps", but it doesn't show up in the journal.
>
> ah -- okay -- the "Datastore" section says my app must store its
> complete state in the datastore, to let it show up in the journal.
> but i'm not sure what "complete state" means -- that's pretty
> daunting, esp. for a program that already saves a lot of state in
> other ways.  is there a minimum that i need to do / can do?  and
> this is all accessed via DBUS?  that's not completely clear from
> the page text.  (and again, a pointer to how to figure out how
> to access the datastore/journal from non-python languages might
> be useful.)

For a basic understanding of what an activity is (in contrast to  
regular apps), you should read

	http://wiki.laptop.org/go/HIG

And yes, DBus is a must as indicated on the very top, use whatever  
DBus bindings exist for your language (e.g., libdbus in the case of C).

> back to my logs:  naively, i thought that since my messages were
> already being stored under ~/.sugar/default/logs/org.x.RoadMap-3.log,
> that i'd be able to access them without much trouble from the
> Journal.  but apparently that's not the case?

Logs have nothing to do with the Datastore.

> i guess this reminds me of something else -- for someone who's
> fairly new at this, the correspondence between the concepts of
> "Datastore" and "Journal" isn't obvious.  the wiki pages all talk
> about the Datastore, but what the user sees is the Journal.  (i
> think this hampered my initial searches, both when skimming pages
> and when actually entering searches on the wiki.)

The Journal is a view onto the Datastore.

> anyway -- thanks for the pointers -- i have a much better
> understanding of what needs to be done, even if i still don't
> know how to go about doing it. :-)  i hope my comments have been
> helpful -- it should be pretty clear that i'm in no position to
> make additions or updates to the wiki myself, at this point.
> i'll try and help where and when i can, however.


Yes, your feedback is welcome. Thanks!

- Bert -





More information about the Sugar-devel mailing list