Activity creation internals

提供: OLPC

This is part 3 of the Sugar internals series. Part 2 is Sugar Components, and part 1 is Understanding Sugar code.

Sugar-activity launcher

You can launch activities using the 'sugar-activity' launcher. This gets a reference to a D-bus service and asks it to create an activity for us. Then it calls gtk.main(). The D-bus service is created in the same process (I don't know why), so the message is enqueued and when gtk.main() is called, D-bus gets a callback.

Shell launcher

Activity code

Anyway, take a look at where the listening service is invoked. You see the 'create' method. It calls 'self._constructor' (which was initialized in __init__ to the module and class name in the file), passing it some sort of handle. When the constructor returns, it calls present(), adds the activity to the list of running activities and returns.

Interesting. There is no GTK main loop here.

document still in progress...

  • ログイン
  • Login with OpenID
About OLPC
About the laptop
About the tablet
OLPC wiki