[sugar] Pie menus for pygtk and OLPC Sugar!

Don Hopkins dhopkins
Thu Feb 22 04:55:26 EST 2007


I've translated my fancy OpenLaszlo pie menu component to 
Python/gtk/cairo, so they work with the OLPC Sugar user interface!

These pie menus have an adaptive layout algorithm, that support linear 
menus which can lay out in all four directions, pie menus, and hybrid 
pie/linear menus (automatically limiting the number of pie items to 8, 
and formatting overflow items in as linear menu items below the pie).

I'm just learning pygtk, so they aren't as integrated or as fleshed out 
as they should be yet, and they don't actually do anything but print 
debugging messages so far, but this is a good first cut that's demoable.

I like the cairo drawing module! It's easy to use, and the graphics and 
feedback highlighting looks nice.

It's all written in one file of Python code.
You should be able to run the demo, which is included in the file, just 
by going "python piemenu.py" on an OLPC or Python system with pytgk and 
cairo installed.

I'd really appreciate it if anyone who knows pygtk would look at the 
code and give me some feedback about what I'm doing wrong and how to 
improve them, please.

Next I have to flesh out input tracking and notification, and figure out 
how to send events during tracking when they pop up, the mouse moves, 
item changes, when items are selected, sub menus are selected, etc.
And then of course there's a some frosting to implement like keyboard 
navigation, submenu browsing, screen edge handling, accessibility, popup 
animation, titles, tooltips, icons, shaped windows, disabled items, etc.
Also I'd like to integrate them with glade and the persistence stuff so 
you can load them in from xml files, edit them with a property sheet, 
and even edit live menus with direct manipulation, etc.

Here is the source code (which is GPL):

http://www.donhopkins.com/home/piemenu.py

I've uploaded a picture here:

http://www.donhopkins.com/home/pygtk-piemenu.png

   -Don



More information about the Sugar-devel mailing list