Understanding Sugar code: Difference between revisions
No edit summary |
No edit summary |
||
Line 38: | Line 38: | ||
It looks like most of these python scripts are stored in /usr/bin. We can read the python scripts and see what they do. |
It looks like most of these python scripts are stored in /usr/bin. We can read the python scripts and see what they do. |
||
less /usr/bin/sugar-shell |
bash-3.1# less /usr/bin/sugar-shell |
||
This thing starts a sugar environment. It also relies on a lot of other stuff, and it looks like the OLPC developers expect a lot of changes here as they make progress on getting sugar into shape. It references GTK, dbus, nm applet, and lots of stuff. |
This thing starts a sugar environment. It also relies on a lot of other stuff, and it looks like the OLPC developers expect a lot of changes here as they make progress on getting sugar into shape. It references GTK, dbus, nm applet, and lots of stuff. |
||
less /usr/bin/sugar-nm-applet |
bash-3.1# less /usr/bin/sugar-nm-applet |
||
Oh, look, this is the network manager utility. OK, and then the activity factory will be triggered whenever a new activity is selected on the bottom.... |
Oh, look, this is the network manager utility. OK, and then the activity factory will be triggered whenever a new activity is selected on the bottom.... |
||
Line 51: | Line 51: | ||
The sugar-shell process has a parent of 1285... |
The sugar-shell process has a parent of 1285... |
||
ps -eaf | grep 1285 |
bash-3.1# ps -eaf | grep 1285 |
||
olpc 1285 1269 0 15:46 ? xinit /home/olpc/.xinitrc -- -auth /home/olpc/.serverauth.1269 |
olpc 1285 1269 0 15:46 ? xinit /home/olpc/.xinitrc -- -auth /home/olpc/.serverauth.1269 |
||
How about that? In the olpc home directory, there is a hidden .xinitrc file. Let's look! |
How about that? In the olpc home directory, there is a hidden .xinitrc file. Let's look! |
||
less ~olpc/.xinitrc |
bash-3.1# less ~olpc/.xinitrc |
||
Well, this thing launches both the tinderbox and the sugar-shell. It looks like the sugar shell is launched within the dbus-launch utility. |
Well, this thing launches both the tinderbox and the sugar-shell. It looks like the sugar shell is launched within the dbus-launch utility. |
Revision as of 17:07, 22 February 2007
OK, Sugar runs on an OLPC. The OLPC runs a stripped down Fedora Linux Operating System.
Open the Developer Console, and go to the Terminal tab. Click in the Terminal window, and switch to the root account:
To do this, let's use the superuser command, "su".
[olpc@localhost]$ su
What runs as part of sugar? Let's see what processes have the keyword sugar using both the "ps" command to list processes, and the grep command to filter for the processes with the word "sugar" in them.
bash-3.1# ps -eaf | grep sugar olpc 1290 1285 3 15:46 ? /usr/bin/python /usr/bin/sugar-shell olpc 1293 1290 0 15:46 ? matchbox-window-manager -kbdconfig /usr/share/sugar/kbdconfig ... olpc 1296 1 0 15:46 ? dbus-launch --exit-with-session sugar-shell olpc 1298 1 0 15:46 ? /usr/bin/python /usr/bin/sugar-presence-service olpc 1302 1 0 15:46 ? /usr/bin/python /usr/bin/sugar-clipboard olpc 1304 1 0 15:46 ? /usr/bin/python /usr/bin/sugar-nm-applet olpc 1306 1 4 15:46 ? python /usr/bin/sugar-console olpc 1339 1285 1 15:46 ? grep sugar
Most things seem to run on python, not a big suprise. But right here, we can see some key architectural divisions:
- A shell
- A presence service (the right side of the sugar interface)
- A clipboard (The left side of the sugar interface)
- A nm applet utility of some kind (This might be the bottom stuff in the sugar interface)
- A console (probably the development console)
Also, there are two non-python type processes running, dbus-launch, and a matchbox-window-manager. I think matchbox is an automated test utility (notice it's spawned from the sugar-shell), and the dbus is for Inter-process communications (supporting the presence service, amongst other things)
So the questions are...
What starts the sugar shell? What is each service or utility?
It looks like most of these python scripts are stored in /usr/bin. We can read the python scripts and see what they do.
bash-3.1# less /usr/bin/sugar-shell
This thing starts a sugar environment. It also relies on a lot of other stuff, and it looks like the OLPC developers expect a lot of changes here as they make progress on getting sugar into shape. It references GTK, dbus, nm applet, and lots of stuff.
bash-3.1# less /usr/bin/sugar-nm-applet
Oh, look, this is the network manager utility. OK, and then the activity factory will be triggered whenever a new activity is selected on the bottom....
[initialization]
The sugar-shell process has a parent of 1285...
bash-3.1# ps -eaf | grep 1285 olpc 1285 1269 0 15:46 ? xinit /home/olpc/.xinitrc -- -auth /home/olpc/.serverauth.1269
How about that? In the olpc home directory, there is a hidden .xinitrc file. Let's look!
bash-3.1# less ~olpc/.xinitrc
Well, this thing launches both the tinderbox and the sugar-shell. It looks like the sugar shell is launched within the dbus-launch utility.
So that's where the sugar user interface starts... it's:
exec dbus-launch --exit-with-session sugar-shell
We can read down from the sugar-shell and read almost all the code from that point down. That's pretty nice.