User:Tdang/XO Setup

From OLPC
Jump to navigation Jump to search

My XO Setup

XO Name: Abiyoyo

Primary User Age: 38 (but same setup for 4-year-old's computer)

Operating System: OLPC Fedora / Sugar

Build: 656

SD Card: None

Hardware Mods: None

Peripherals: little USB mouse, 1G USB stick

Pre-installed Activities Removed: None

Flash Player: LNX 9.0.115.0

Favorite Activities Added: Speak, GCompris Sudoku

Essential Non-Sugar Software:

  • Firefox
  • Flash player

Modifications:

  • Installed Firefox
  • Sugarized Firefox
  • Installed Adobe Flash player
  • Made gamepad keys zoom in Read
  • Created homepage for Browse
  • Prevent re-starting X
  • Changed Home View background color
  • Removed "Register" from Shutdown menu
  • Disabled hot corners
  • Added clock to Home View frame

What I like about this setup

I'm trying to stay very close to the standard installation. That's partly for my curiosity, and partly so that any contributions I make will be applicable to the standard installation.

Browse is simply not good enough as a browser. I'll use it sometimes, particularly to install new activities. But its inability to search within a web page, and inability to handle useful pop-ups (required for attaching a file in gmail, for instance) make it not good enough.

Firefox seems a possibly good alternative. I just started using Firefox instead of Opera, and so far the main appeal of Firefox is that I have it fully Sugarized.

The XO as a book-reader is fantastic. I read a lot of academic papers in PDF. With the slight modification to Read allowing me to zoom with the game keys as well as navigate, I can really use the XO in eBook mode.

The changes I've made to Sugar make it a bit more comfortable, and feel more fun and personal.

What I dislike about this setup

I suspect that I'll buy into the Journal philosophy in time, but I'm not used to it yet, and so I miss directory trees.

Write is OK, but not good enough to make me want to work on it instead of NeoOffice on my iBook.

I don't yet have LaTeX.

I don't have any satisfactory spreadsheet capability.

How to duplicate my XO Setup

Most of what I do here is somewhat specific to build 656. For a different build, files might need to be edited differently.

If there are any mistakes you find in these instructions, please let me know.

Update the OS

Update the OS as soon as you reasonably can. This is because when you update the OS, you'll lose pretty much anything you've done with your XO.

Hopefully, the standard instructions on this will work for you...

If you're networked, you can use olpc-update.

If you're not networked, or you're having trouble with olpc-update, you can do an activated upgrade.

Get Familiar with Command Line

You need to be comfortable acting on the command line and editing files to do most of what's here.

If you need, I hope my command line tips are helpful.

Pick an Editor

I won't walk you through all the choices of text editor. Many like vi, and there's other options like emacs. In principle it's possible to use the Write activity.

I use nano. It's not very powerful, but it's very intuitive.

To edit a file, type (for instance):

nano /usr/share/sugar/shell/view/frame/frameclock.py

nano Hints

Here's a couple of hints for using nano:

  • To find out what line of a file you're on, hit Ctrl-C. That can be useful for following editing directions.
  • To save a file without exiting, the command is Ctrl-O. But that doesn't work on the XO, since Ctrl-O brings you to the Journal. You can cheat by instead hitting (Esc, Esc)-O. That is, hit Esc twice, followed by O. If this is too awkward, just use Ctrl-X to save and exit, and then go back into the file again.

Install Firefox

(Instructions from samphilomath at OLPCNews forum)

Here's what you type:

su
nano /etc/yum.repos.d/olpc-koji-ship2.repo

Now you're editing an "exclude" file. Go down and erase firefox from the list. (and make sure to delete the comma which goes with it so that there aren't two commas in a row.)

Ctrl-X exits nano and saves.

At this point, you should exit all programs except Terminal. yum install can be memory-intensive, and it's annoying to have it quit midway on you.

Type:

yum install firefox

Follow the directions. When completed, type "exit" to stop being superuser.

Sugarize Firefox

(Instructions and helpful files from CatMoran at OLPCNews forum)

Type:

su
wget http://www.catmoran.com/olpc/libsugarize.so
chmod 755 libsugarize.so
wget http://www.catmoran.com/olpc/sug
chmod 755 sug
wget http://www.catmoran.com/olpc/ff.svg
./sug

If the above doesn't work because the catmoran.org domain is down, you may have luck by looking here.

  • You'll be prompted for an activity name. Enter "Firefox"
  • You'll be prompted for an icon file. Enter "ff.svg"
  • You'll be prompted for the command to start the program. Enter "firefox". (This is case-sensitive, so enter it in all lowercase.)
  • You'll be prompted for an organization path. Enter "org.mozilla ".

Now, reboot Sugar. (Hit Ctrl-Alt-Erase). There should be an activity icon which is "FF" in a circle.

Flash

I'm actually not positive about this.

A good while ago, I followed the instructions to install Flash for Browse, as well as removing click-to-play (instructions on same page).

I did nothing special with regard to Flash after installing Firefox, and everything works well in both Firefox and Browse. So I assume that earlier installation was appropriate for Firefox as well.

Modifying Activities

Give Browse a Home Page

I particularly wanted a real home page for my mostly-illiterate 4-year-old, so I could set up a page of links to his favorites rather than the default home page.

This might be too round-about, but it worked for me.

su
nano /usr/share/library-common/index.html

In that file, replace "/home/olpc/.library_pages/search/bundle_index.html" with "/home/olpc/.mozilla/home.html".

Then, you don't need--in fact you don't want--to be superuser any more.

exit
nano /home/olpc/.mozilla/home.html

Set up whatever kind of home page you want in that file. Or copy an existing home page from USB stick or whatever. You'll be able to modify it in the future without being superuser.

You can make the same file the home page for Firefox.

Gamepad Zoom in Read

(Instructions from braingram and Ben James Ben at OLPCNews])

I've actually noticed that this change isn't perfect, that sometimes the keys don't zoom. I believe it depends on which menu bar is up top when you use the keys, but I'm not sure. I'll try to fix it, but still it's much better than nothing.

su
cp /usr/share/activities/Read.Activity/readactivity.py /usr/share/activities/Read.Activity/readactivity-bak.py
nano /usr/share/activities/Read.Activity/readactivity.py

In that file, go to line 388. (Almost at the end, remember Ctrl-C tell you the line number in nano.) Change the function there to match:

   def _key_press_event_cb(self, widget, event):
       keyname = gtk.gdk.keyval_name(event.keyval)
       logging.debug("Keyname Press: %s, time: %s", keyname, event.time)
       if keyname == 'KP_End':
           self._view_toolbar._zoom_in_cb(self._view_toolbar._zoom_in)
           return True
       if keyname == 'KP_Home':
           self._view_toolbar._zoom_out_cb(self._view_toolbar._zoom_out)
           return True
       if keyname == 'c' and event.state & gtk.gdk.CONTROL_MASK:
           self._view.copy()

Tweaking Sugar

Some of the changes I've made are changes to the Sugar UI itself.

Pre-Tweaking Precaution

Prevent X Restarting

Before changing any Sugar files, I strongly recommend a precautionary change. By default, X (the graphical environment Sugar runs in) restarts itself automatically. That means if something goes wrong as Sugar is starting, it quits and dumps out to the console, and then restarts and so on loops and loops and it's very hard to fix.

Michael Stone gave me good advice to prevent this from happening at the forum. Before making any (even minor) tweaks to Sugar, I follow that advice. (You only need to do it once, of course.)

Make a backup copy of original file(s)

For safety's sake, in case you forget how to reverse what you did, or in case you really screw up, you probably should back up any Sugar files before modifying them. Just (for instance):

cp /usr/share/sugar/shell/view/frame/frame.py /usr/share/sugar/shell/view/frame/frame-bak.py

Practice Tweak--Background Color

Just to get familiar with making changes to Sugar, and because it's fun to personalize, how about changing the background color of the Home view?

su
cp /usr/share/sugar/shell/view/home/HomeBox.py /usr/share/sugar/shell/view/home/HomeBox-bak.py
nano /usr/share/sugar/shell/view/home/HomeBox.py

Line 45 will look something like

       hippo.CanvasBox.__init__(self, background_color=0x34FF4AFF)

Go nuts changing the color. I'm pretty sure it's RGBA color. You can get help figuring out the hex for the color you like by using the color tool in the Paint activity. Whatever number you get there will be the first 6 characters (after the "0x") of the color number. The last two characters are for transparency, so if they're "FF", it's opaque and should look like it does in Paint.

Turn Off "Register"

Since we're never going to to register our XO's with a school server, we don't need to be reminded regularly. So we might as well take that out. It's a minor point, but it's also a minor edit.

Simply comment out the following lines in /usr/share/sugar/shell/view/frame/HomeBox.py:

#        if not self._profile.is_registered():
#            item = gtk.MenuItem(_('Register'))
#            item.connect('activate', self._register_activate_cb)
#            palette.menu.append(item)
#            item.show()

Turn Off Hot Corners

There's at least one thing about the standard Sugar interface which most users want to change. (I think it might change by default in future updates.) The hot corners are very annoying for me, and many others. They also feel unnecessary since you can accomplish the same thing(s) by pressing the special navigation buttons.

This requires just commenting out two lines in /usr/share/sugar/shell/view/frame/eventarea.py:

   def _create_invisible(self, x, y, width, height):
       invisible = gtk.Invisible()
#        invisible.connect('enter-notify-event', self._enter_notify_cb)
#        invisible.connect('leave-notify-event', self._leave_notify_cb)

That's all that's needed.

Add a Clock to Home View

It's very unusual these days to have any electronic device which doesn't tell you what time it is. There are a couple full-fledged clock activities (clock and random tune alarm clock), but they're overkill for a constant clock.

To add a clock, I create one new file and modify one existing file. Both files are in /usr/share/sugar/shell/view/frame

The existing file which gets modified is zoomtoolbar.py. First, up top in the imports it needs:

from frameclock import FrameClock

Down actually in the code of zoomtoolbar.py:

       palette = Palette(_('Activity'))
       palette.props.invoker = FrameWidgetInvoker(button)
       palette.set_group_id('frame')
       button.set_palette(palette)

       # new clock code here
       clock = FrameClock("%a %b %d %I:%M %p")  # Show day month date HH:MM AM/PM
#       clock = FrameClock("%D %H:%M:%S")  # show date & time through seconds
#       self.insert(clock,0)  # Put clock to left of navigation buttons
       self.insert(clock,-1)  # Put clock to right of navigation buttons
       clock.show()
       clock.start()

You see above that there are format choices. You can use time format codes in the call to FrameClock() to get the format you like. And you can decide when you do insert(clock...) whether you want the clock on the left or the right of the navigation buttons.

This requires a definition of FrameClock, which happens in the new file, frameclock.py:

# frameclock -- a little digital clock widget for the Home frame
# Actually, there's nothing about this specific to that use, could
# be used as a widget anywhere.
# March 28, 2008 Timothy Dang

from gettext import gettext as _

import gtk

import time
import gobject
import string
import pango

class FrameClock(gtk.ToolItem):

   def __init__(self,new_format="%D %H:%M:%S"):
       gtk.ToolItem.__init__(self)
       self.set_expand(True)
       self.format=new_format
       self.update_interval = 1000  # update every second (recommended)

   def start(self):
       self.label = gtk.Label(time.strftime(self.format))
       self.add(self.label)
       self.label.show()
       self.update_timer = gobject.timeout_add(self.update_interval,self.update)

   def update(self):
       time_string = time.strftime(self.format)
       self.label.set_markup(""+time_string+"")
       self.label.show()
       return 1  # This seems to be needed to continue the update_timer

That should give you something which looks like: screenshot of Home View with clock on top frame bar