[sugar] Ringed pie menus!

Don Hopkins dhopkins
Tue Feb 27 01:33:18 EST 2007


I gave it a try, an implemented ringed pie menus!

They work as described below: you configure max_pie_items to be an array 
of numbers, which controls the maximum number of pie items in each ring. 
If max_pie_items is a number instead of an array, it just makes one ring 
with that maximum number of pie menu items, and makes the rest linear 
items. If it's an array of numbers, then you get one ring for each 
number, with that number of pie items in each ring, and the rest linear 
items.

What if you want each ring to have a different initial_angle or a 
different clockwise flag? I added the feature that you can set the 
"clockwise" to an array of booleans, or "initial_angle" to an array of 
numbers, and they will separately configure each corresponding ring. If 
you set clockwise to a boolean or initial_angle to a number, then the 
same value will be used for every ring.

The advantage to this approach is that the add_item api is still the 
same (flat and simple), and you don't have to use arrays if you don't 
need to use rings, so the client does not have to concern themselves 
with the rings, because the layout routine classifies items and arranges 
them into rings according to the constraints controlled by the pie menu 
and item instance variables.

It's still kind of funky and experimental, but at least it gives us 
something to play around with to see what works and what sucks.

The new demo now has a "Ringed" pie menu with three rings specified as 
[4, 8, 24] for four in the inner ring, eight in the next ring, and 24 in 
the outer ring, for a total of 36 items (A-Z and 0-9).

New pie menu source code:

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

    -Don


Don Hopkins wrote:
>
> I'd like to figure out a nice api for pie menus with rings, that 
> doesn't complicate the more common use cases without any rings.
> How about generalizing the "max_pie_items" limit (which defines the 
> limit of pie items before it starts overflowing to linear items) from 
> a number to an array of numbers, which specify the maximum number of 
> items in each ring, and after all the pie rings are filled up only 
> then does it start using linear overflow items.
> The default max_pie_items would then be [8] instead of 8 as it is now, 
> and you could set it to [4, 8, 12] to get a three ring pie menu with 4 
> on the inside, 8 in the middle ring, and 12 in the outer ring, and the 
> rest of the items linear. Or you could change the last number 12 to 
> 100 to make the outer ring accommodate up to 100 items.
>



More information about the Sugar-devel mailing list