Sugar Components: Difference between revisions
m (Reverted edits by 82.28.159.19 (Talk) to last revision by Patrol) |
|||
(53 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
This is part 2 of the [[Sugar]] internals series. Part 1 is [[Understanding Sugar code]]. Part 3 is [[Activity creation internals]]. |
|||
==Sugar Components== |
==Sugar Components== |
||
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 |
==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.FirstTimeDialog import FirstTimeDialog |
||
Line 9: | Line 12: | ||
>>> from model.ShellModel import ShellModel |
>>> from model.ShellModel import ShellModel |
||
This looks a good bit like a [http://en.wikipedia.org/wiki/Model-view-controller Model, View, Controller] design pattern. |
|||
⚫ | |||
Also, here is a bit about [http://docs.python.org/tut/node8.html Python Modules and Packages]. |
|||
==Sugar's View Package== |
|||
This thing's python path is sugar.view |
|||
It includes these modules: |
|||
* ActivityHost -- For sharing activities and managing a chat for each shared activity |
|||
* BuddyIcon -- The actual buddy Icon (an object) in the neighborhood & friends window. |
|||
* BuddyMenu -- Popup menu when you point to a buddy in your neighborhood (or friends window?) |
|||
* FirstTimeDialog -- Special dialog to get your nickname. Also randomly assigns you a color. |
|||
* OverlayWindow -- something to do with window management?? |
|||
* Shell -- This module pulls together several objects and manages the actuall Shell class. |
|||
* clipboardicon -- logic for one item on the clipboard. |
|||
* clipboardmenu -- manages items on clipboard and copy status. |
|||
* stylesheet -- Sets default sizes and colors for sugar UI icons. |
|||
And these sub-packages: |
|||
====frame==== |
|||
Manages the [[OLPC Human Interface Guidelines/The Laptop Experience/The Frame|OLPC-HIG sugar ui side frame]]. |
|||
*ActivitiesBox |
|||
*Frame |
|||
*FriendsBox |
|||
*PanelWindow |
|||
*ZoomBox |
|||
*clipboardbox |
|||
*clipboardpanelwindow |
|||
*notificationtray |
|||
*overlaybox |
|||
====home==== |
|||
Manages the [[OLPC Human Interface Guidelines/The Laptop Experience/Zoom Metaphor|OLPC-HIG zoom metaphor]] of the sugar ui center for the Mesh, Friends, & Donut views. |
|||
*FriendView -- ?[[OLPC Human Interface Guidelines/The Laptop Experience/Zoom Metaphor#Groups| OLPC-HIG Groups]] |
|||
*FriendsBox -- ?[[OLPC Human Interface Guidelines/The Laptop Experience/Zoom Metaphor#Groups| OLPC-HIG Groups]] |
|||
*HomeBox -- ?[[OLPC Human Interface Guidelines/The Laptop Experience/Zoom Metaphor#Home| OLPC-HIG home]] |
|||
*HomeWindow -- ? |
|||
*MeshBox -- ?[[OLPC Human Interface Guidelines/The Laptop Experience/Zoom Metaphor#Neighborhood| OLPC-HIG Neighborhood]] |
|||
*MyIcon -- Initializes [[OLPC Human Interface Guidelines/The Sugar Interface/Icons#The XO|OLPC-HIG user icon]] color based on stored preference file. |
|||
*activitiesdonut -- Manage the activities in the process donut view. |
|||
⚫ | |||
Sugar's Shell Module 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 -- (The GIMP Tool Kit) |
|||
* gobject -- (gtk package) |
|||
* wnck -- (Window Navigator Construction Kit) |
|||
Lots of Sugar UI imports: |
|||
* view.stylesheet |
|||
* style |
|||
* HomeWindow |
|||
* PresenceService |
|||
* ActivityHost |
|||
* ActivityFactory |
|||
* Activity |
|||
* Frame |
|||
* ShellModel |
|||
* HardwareManager |
|||
* KeyGrabber |
|||
* AudioManager |
|||
* env |
|||
* sugar |
|||
⚫ | |||
The Model Packages has the following modules: |
|||
* BuddyModel -- Tracks the details and connection to a single buddy on the mesh |
|||
* Friends -- Adds and removes Buddies to a list of friends |
|||
* Invites -- Invites Buddies to shared activities. |
|||
* MeshModel -- Tracks Activities, presense, and connections |
|||
* Owner -- Tracks details about the OLPC owner (nickname, icon, etc.) |
|||
* ShellModel -- Tracks List of Activities, Presence, List of Friends, Home, also announces presence of computer to others. |
|||
* homeactivity -- This class is instantiated to control a running activity. |
|||
* homemodel -- This is the data model used to manage a running activity. |
|||
[[Category:Python]] |
|||
⚫ | |||
[[Category:Sugar]] |
Latest revision as of 19:12, 27 October 2012
This is part 2 of the Sugar internals series. Part 1 is Understanding Sugar code. Part 3 is Activity creation internals.
Sugar Components
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 modules:
- ActivityHost -- For sharing activities and managing a chat for each shared activity
- BuddyIcon -- The actual buddy Icon (an object) in the neighborhood & friends window.
- BuddyMenu -- Popup menu when you point to a buddy in your neighborhood (or friends window?)
- FirstTimeDialog -- Special dialog to get your nickname. Also randomly assigns you a color.
- OverlayWindow -- something to do with window management??
- Shell -- This module pulls together several objects and manages the actuall Shell class.
- clipboardicon -- logic for one item on the clipboard.
- clipboardmenu -- manages items on clipboard and copy status.
- stylesheet -- Sets default sizes and colors for sugar UI icons.
And these sub-packages:
frame
Manages the OLPC-HIG sugar ui side frame.
- ActivitiesBox
- Frame
- FriendsBox
- PanelWindow
- ZoomBox
- clipboardbox
- clipboardpanelwindow
- notificationtray
- overlaybox
home
Manages the OLPC-HIG zoom metaphor of the sugar ui center for the Mesh, Friends, & Donut views.
- FriendView -- ? OLPC-HIG Groups
- FriendsBox -- ? OLPC-HIG Groups
- HomeBox -- ? OLPC-HIG home
- HomeWindow -- ?
- MeshBox -- ? OLPC-HIG Neighborhood
- MyIcon -- Initializes OLPC-HIG user icon color based on stored preference file.
- activitiesdonut -- Manage the activities in the process donut view.
Sugar's Shell Module
Sugar's Shell Module 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 -- (The GIMP Tool Kit)
- gobject -- (gtk package)
- wnck -- (Window Navigator Construction Kit)
Lots of Sugar UI imports:
- view.stylesheet
- style
- HomeWindow
- PresenceService
- ActivityHost
- ActivityFactory
- Activity
- Frame
- ShellModel
- HardwareManager
- KeyGrabber
- AudioManager
- env
- sugar
Sugar's Model Package
The Model Packages has the following modules:
- BuddyModel -- Tracks the details and connection to a single buddy on the mesh
- Friends -- Adds and removes Buddies to a list of friends
- Invites -- Invites Buddies to shared activities.
- MeshModel -- Tracks Activities, presense, and connections
- Owner -- Tracks details about the OLPC owner (nickname, icon, etc.)
- ShellModel -- Tracks List of Activities, Presence, List of Friends, Home, also announces presence of computer to others.
- homeactivity -- This class is instantiated to control a running activity.
- homemodel -- This is the data model used to manage a running activity.