Difference between revisions of "Activity Team/Compatibility Tips"
Jump to navigation
Jump to search
(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...) |
|||
Line 9: | Line 9: | ||
version = "unknown" | version = "unknown" | ||
+ | === get_activity_root() === | ||
+ | Some earlier OLPC builds (e.g., 656) do not have activity.get_activity_root(), so you need to catch an exception if you want to access the version. | ||
+ | |||
+ | try: | ||
+ | path = os.path.join(activity.get_activity_root(), "instance") | ||
+ | except: | ||
+ | # early versions of Sugar (656) didn't support get_activity_root() | ||
+ | path = "/home/olpc/.sugar/default/org.sugarlabs.[your activity name]" | ||
=== Screen size === | === Screen size === |
Revision as of 18:13, 4 February 2009
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"
get_activity_root()
Some earlier OLPC builds (e.g., 656) do not have activity.get_activity_root(), so you need to catch an exception if you want to access the version.
try: path = os.path.join(activity.get_activity_root(), "instance") except: # early versions of Sugar (656) didn't support get_activity_root() path = "/home/olpc/.sugar/default/org.sugarlabs.[your activity name]"
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]