Activity Team/Compatibility Tips

From Sugar Labs
< Activity Team
Revision as of 12:33, 2 February 2009 by Walter (talk | contribs) (New page: ==Compatibility Tips== === SUGAR_BUNDLE_VERSION === Some earlier OLPC builds (e.g., 703) do not have a bundle version environment variable, so you need to catch an exception if you want t...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Compatibility Tips

SUGAR_BUNDLE_VERSION

Some earlier OLPC builds (e.g., 703) do not have a bundle version environment variable, so you need to catch an exception if you want to access the version.

try:
    version = os.environ['SUGAR_BUNDLE_VERSION']
except:
    version = "unknown"


Screen size

The screen size varies on different hardware platforms. If you develop in an emulator, it is worthwhile trying different sizes to make sure your activity scales properly.

Some useful utilities:

width = gtk.gdk.screen_width()
height = gtk.gdk.screen_height()
toolbox = activity.ActivityToolbox(self)
toolboxheight = toolbox._activity_toolbar.size_request()[1]