# Changes

,  20:38, 23 February 2010
m
Line 8: Line 8:
<div class="visualClear"></div>

<div class="visualClear"></div>
−
There has been a discussion on the OLPC-sur list about the need for a square root function in Turtle Art. Below, I have documented the process I used for adding this functionality with the hope that others may feel comfortable in emulating me in regard to making changes and enhancements to Sugar and Sugar Activities and sharing those enhancements with the community.
+
There has been a discussion on the OLPC-sur list about the need for a square root function in Turtle Art. Below, I have documented the process I used for adding this functionality with the hope that others may feel comfortable in emulating me in regard to making changes and enhancements to Sugar and Sugar Activities and sharing those enhancements with the community. Beginners may find [[Activity_Team/Modifing_an_Activity]] useful.
−
You can download the unofficial [http://wiki.laptop.org/images/9/9e/Turtleart-11.xo Turtleart-11.xo here]. The .xo archive can be opened by relabeling it(for example) to a .zip file.
+
+

+
'''Windows users notes'''
+
The .xo archive can be opened by relabeling it(for example) to a .zip file.

Within the archive you find the files to be edited, Python source files talogo.py and tasetup.py and the images directory images/en/numbers . Python source files can be edited with [http://www.python.org/ Python].

Within the archive you find the files to be edited, Python source files talogo.py and tasetup.py and the images directory images/en/numbers . Python source files can be edited with [http://www.python.org/ Python].

Line 21: Line 24:
from math import sqrt

from math import sqrt

and

and
defprim(lc,'sqrt', 1, lambda lc,x: int(sqrt(x)))
+
defprim(lc,'sqrt', 1, lambda lc,x: int(sqrt(x)))

* And I had to define a new brick for square root in tasetup.py and describe the bricks attributes: its size; how it connects to other bricks; and default values.

* And I had to define a new brick for square root in tasetup.py and describe the bricks attributes: its size; how it connects to other bricks; and default values.
('sqrt','sqrt','sqrt',100),
+
('sqrt','sqrt','sqrt',100),

and

and
'sqrt':    (('num',True,0,20),('num',False,42,20)),
+
'sqrt':    (('num',True,0,20),('num',False,42,20)),
* Finally, I had to create a graphic for the brick (images/en/numbers/sqrt.gif) and modify the panel for numbers (images/en/numbers/numbersgroup,gif and numbersmask.gif). I made similar changes to the Spanish version (images/es).
+
* Finally, I had to create a graphic for the brick (images/en/numbers/sqrt.gif) and modify the panel for numbers (images/en/numbers/numbersgroup,gif and numbersmask.gif). I made similar changes to the Spanish version (images/es) and French version (images/fr).

[[Image:Sqrt.gif|thumb|left|sqrt.gif]]

[[Image:Sqrt.gif|thumb|left|sqrt.gif]]

[[Image:Numbersgroup.gif|thumb|left|The numbers palette]]

[[Image:Numbersgroup.gif|thumb|left|The numbers palette]]

[[Image:Numbersgroup-es.gif|thumb|left|The Spanish version]]

[[Image:Numbersgroup-es.gif|thumb|left|The Spanish version]]
+
[[Image:Numbersgroup-fr.gif|thumb|left|The French version]]

<div class="visualClear"></div>

<div class="visualClear"></div>
Line 49: Line 53:
:I also created images/en/numbers/sqrt.gif

:I also created images/en/numbers/sqrt.gif

:(I also made corresponding changes in the images/es tree)
+
:(I also made corresponding changes in the images/es and images/fr trees)
+
* I made an .xo bundle so I could let other people easily install and test my changes (the following command will create TurtleArt-NN.xo in turtleart-activity/dist):
+
python setup.py dist_xo

* and generate a patch

* and generate a patch

git diff -U > patch

git diff -U > patch
* and send the patch to the maintainer (Brian Silverman) for review
+
* and sent the patch to the project maintainer (Brian Silverman) for review
mailto:bss...
+
mailto:bss...

* The maintainer made one suggestion:

* The maintainer made one suggestion:
all looks good to me.
+
:all looks good to me.
+
:One question. Are you sure you want the "int" of the answer? In the Java version everything is a float, and even in the python version xcor, ycor, and friends are floats. None of the calculations assume ints I don't think.
One question. Are you sure you want the "int" of the answer? In the Java version everything is a float, and even in the python version xcor, ycor, and friends are floats. None of the calculations assume ints I don't think.

* I made the change and did some more testing.

* I made the change and did some more testing.
+
defprim(lc,'sqrt', 1, lambda lc,x: sqrt(x))
+
==More steps==
+
* Brian asked me to take over as the maintainer of the Python version of Turtle Art, so I needed to "add" my new files, then "commit" and "push" my patch:
+
−
defprim(lc,'sqrt', 1, lambda lc,x: sqrt(x))
+
git-commit -a
* next: "commit" and "push" the patch
+
Created commit fa7a12f: new fileimages/en/numbers/sqrt.gif
git-commit
+
3 files changed, 0 insertions(+), 0 deletions(-)
Created commit fa7a12f: modifiedMANIFEST
+
11 files changed, 453 insertions(+), 459 deletions(-)
8 files changed, 453 insertions(+), 459 deletions(-)

mode change 100755 => 100644 NEWS

mode change 100755 => 100644 NEWS

rewrite images/en/numbers/numbersgroup.gif (81%)

rewrite images/en/numbers/numbersgroup.gif (81%)
Line 71: Line 79:

rewrite images/fr/numbers/numbersgroup.gif (79%)

rewrite images/fr/numbers/numbersgroup.gif (79%)
+

−
git-commit -a
−
Created commit 1536a4c: new file:  images/en/numbers/sqrt.gif
−
3 files changed, 0 insertions(+), 0 deletions(-)

create mode 100644 images/en/numbers/sqrt.gif

create mode 100644 images/en/numbers/sqrt.gif

create mode 100644 images/es/numbers/sqrt.gif

create mode 100644 images/es/numbers/sqrt.gif
Line 86: Line 90:
Total 29 (delta 20), reused 0 (delta 0)

Total 29 (delta 20), reused 0 (delta 0)

To ssh://dev.laptop.org/git/projects/turtleart-activity
+
To ssh://dev.laptop.org/git/projects/turtleart-activity/

18f3739..1536a4c  master -> master

18f3739..1536a4c  master -> master
+
+
* and I need to generate a "tar ball" of the new source code bundle and put it on dev.laptop.org
+
+
python setup.py dist_source
+
scp dist/TurtleArt-11.tar.bz2 walter@dev.laptop.org:/var/www/sugar/sources/turtleart-activity/
+
+
Further instructions on the Sugar release process are found here: [[Development Team/Release#New_modules_proposal]]. The instructions on the [[Development Team/Code Review]] page are also helpful.

==The patch==

==The patch==
123

edits