[sugar] [PATCH] get_icon_name(): add step kwarg

Martin Dengler martin
Wed Jun 11 20:30:26 EDT 2008


On Thu, Jun 12, 2008 at 01:15:03AM +0100, Martin Dengler wrote:
> [1-line patch to sugar/graphics/icon.py]

A more performant approach to get_icon_name(), which I think is called
a fair bit, would be to cache the list of available files to avoid
exercising the file systme a billion times as the wireles signal
changes (ooh, imagine the stat()s when showing the mesh view and there
are loads of APs around changing signal strength all the time).

A related idea is to change this function to really do what it seems
to be meaning to do which is quantize the input range 0-100 into the
output range (defined by the number of different icon files).  However
consider that this would affect icon file names if the current user
experience is to be preserved.

As the number of files deceases the ratio of files to step size grows
and starts to dominate the time cost of calculating the output range.
And of course my previous suggestion could reduce this cost to
constant time.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.laptop.org/pipermail/sugar/attachments/20080612/ab9f99b8/attachment.pgp 



More information about the Sugar-devel mailing list