Sugar Components

From OLPC
Jump to navigation Jump to search

Sugar Components

This is a continuation of Understanding sugar code. Here, we are in the middle of walking through a sugar shell initialization to see all of the packages and utilities used in the sugar environment. Previously, we saw how Fedora is set up to launch sugar within a python context. Sugar had python launch Matchbox as an X windows environment, and DBUS as an interprocess messaging bus. After importing serveral python libraries (sys, os, gtk, & gobject), and some sugar environment libraries (env, logger, profile, & TracebackUtils), sugar is now going to continue setting up by importing special core python libraries and instantiating various classes and routines... Let's see what happens:

Sugar Package & Module Imports

The sugar-shell has already imported python and sugar environment modules, but now, sugar starts to import component modules from the view and model packages:

>>> from view.FirstTimeDialog import FirstTimeDialog
>>> from view.Shell import Shell
>>> from model.ShellModel import ShellModel

This looks a good bit like a Model, View, Controller design pattern.

Also, here is a bit about Python Modules and Packages.

Sugar's View Package

This thing's python path is sugar.view

It includes these packages:

  • ActivityHost
  • BuddyIcon
  • BuddyMenu
  • FirstTimeDialog
  • OverlayWindow
  • Shell
  • clipboardicon
  • clipboardmenu
  • stylsheet

And these Modules:

  • frame -- Manages the sugar ui side frames.
  • home -- Manages the sugar ui center for the Mesh, Friends, & Donut views.

Sugar's Shell Package

Sugar's Shell package pulls lots of services and system interfaces together and unifies them into a full user interface. The Shell module is a part of the View package.

Imports:

  • logging (sugar logger)
  • gtk
  • gobject (gtk module)
  • wnck -- (don't know this one yet)

Lots of Sugar UI imports:

  • view.stylesheet
  • style
  • HomeWindow
  • PresenceService
  • ActivityHost
  • ActivityFactory
  • Activity
  • Frame
  • ShellModel
  • HardwareManager
  • KeyGrabber
  • AudioManager
  • env
  • sugar

Sugar's Model Module