[Sugar-devel] [RELEASE] Calculate 26

Reinier Heeres reinier at heeres.eu
Tue Dec 23 19:09:45 EST 2008


Hi all,

I just released a new version of Calculate. I know I missed the feature
freeze by about a week, but I was still quite busy finishing the code
refactoring.

Available at:
XO: http://dev.laptop.org/~rwh/calculate/Calculate-26.xo<http://dev.laptop.org/%7Erwh/calculate/Calculate-26.xo>
tarball:
http://dev.laptop.org/pub/sugar/sources/Calculate/Calculate-26.tar.bz2

Many things are improved, from NEWS with a bit more comment:

* Move to new equation parser based on python ast
Calculate now uses the internal python parser to create an Abstract Syntax
Tree (ast). The tree for an equation is evaluated by Calculate itself, so
that operators (mostly divide) can give different results from standard
python (e.g. return Rational numbers). The way functions, help and constants
are included is also much improved and easier to extend by modifying the
files functions.py and constants.py. Speed increase is about a factor 10,
especially noticeable when plotting. (It's also less code and easier to
maintain!)

* Refactor sharing
This is a major improvement and simplifcation. I recommend other activity
authors and sugar developers to have a look at shareable_activity.py. This
provides a class to easily create activities that can be shared (by
inheriting from ShareableActivity). It automatically sets-up a DBus tube and
a service to communicate between a shared instance. Communication is exposed
by the function send_message('message_name', param1=1, param2=2, ...) that
can be processed on the other end through a registered callback or by
overloading the function message_received(). I think this could really be
sufficient for most Activities.

I tested on 767 but it is also compatible with newer api. This could also be
a good reason to use shareable_activity.py: keep sugar-sharing-api-version
voodoo out of the main activity code and keep it more readable. It could
result in less overall duplicate code (a good thing!).

* Refactored equation drawing code
Adding an equation was slow due to the whole list being regenerated. This is
not the case anymore.

* Add languages: bi, cs, en_US, fi, he, hu, sk, sv, sw, wa

This is a development release and I expect a few bugs; if you find any,
please report them. Testing is appreciated!

I'm aware that I probably should move this code over to sugarlabs; however,
I think I don't have access there yet. Marco, Tomeu, Simon, Bernie, any
pointers?

Regards,
-- 
Reinier Heeres
Waalstraat 17
2515 XK Den Haag
The Netherlands

Tel: +31 6 10852639
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20081224/afbc0a42/attachment.htm 


More information about the Sugar-devel mailing list