diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2009-07-21 23:12:39 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2009-07-21 23:12:39 (GMT) |
commit | 3af6613e0c1dd81484b6f6d338e851719410b8a4 (patch) | |
tree | abadf5763b151e38e87ab928fe5798815c91a5f7 /svg | |
parent | be4abfc9f41bbadb9f8e8f94873514ac9af0c006 (diff) |
add storein constructor
Diffstat (limited to 'svg')
-rw-r--r-- | svg/makesvg.py | 5 | ||||
-rw-r--r-- | svg/storein.py | 114 |
2 files changed, 119 insertions, 0 deletions
diff --git a/svg/makesvg.py b/svg/makesvg.py index 43f6ca8..6850184 100644 --- a/svg/makesvg.py +++ b/svg/makesvg.py @@ -31,6 +31,7 @@ def main(): "and.py", \ "arc.py", \ "back.py", \ + "bottompos.py", \ "box1.py", \ "box2.py", \ "clean.py", \ @@ -50,6 +51,7 @@ def main(): "kbinput.py", \ "keyboard.py", \ "left.py", \ + "leftpos.py", \ "myblocksgroup.py", \ "not.py", \ "numbersgroup.py", \ @@ -67,6 +69,7 @@ def main(): "remainder.py", \ "repeat.py", \ "right.py", \ + "rightpos.py", \ "scale.py", \ "sensorsgroup.py", \ "setcolor.py", \ @@ -84,11 +87,13 @@ def main(): "stack2.py", \ "start.py", \ "stopstack.py", \ + "storein.py", \ "storeinbox1.py", \ "storeinbox2.py", \ "templatesgroup.py", \ "textcolor.py", \ "textsize.py", \ + "toppos.py", \ "turtlegroup.py", \ "vres.py", \ "wait.py", \ diff --git a/svg/storein.py b/svg/storein.py new file mode 100644 index 0000000..a3f2dc3 --- /dev/null +++ b/svg/storein.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#Copyright (c) 2009, Sugar Labs + +#Permission is hereby granted, free of charge, to any person obtaining a copy +#of this software and associated documentation files (the "Software"), to deal +#in the Software without restriction, including without limitation the rights +#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +#copies of the Software, and to permit persons to whom the Software is +#furnished to do so, subject to the following conditions: + +#The above copyright notice and this permission notice shall be included in +#all copies or substantial portions of the Software. + +#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +#THE SOFTWARE. + +import sys +import os +import os.path +import gettext + +def main(): + + myname = "storein" + if len(sys.argv) != 2: + print "Error: Usage is " + myname + ".py lang" + return + + t = gettext.translation("org.laptop.TurtleArtActivity", "../locale", languages=[sys.argv[1]]) + _ = t.ugettext + t.install() + + mystring = _("store in") + mygroup = "myblocks" + + print mystring + + data0 = \ +"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>]\n\ +<!-- Created with Inkscape (http://www.inkscape.org/) -->]\n\ +<svg]\n\ + xmlns:svg=\"http://www.w3.org/2000/svg\"]\n\ + xmlns=\"http://www.w3.org/2000/svg\"]\n\ + xmlns:xlink=\"http://www.w3.org/1999/xlink\"]\n\ + version=\"1.0\"]\n\ + width=\"142\"]\n\ + height=\"60\"]\n\ + id=\"svg2\">]\n\ + <defs]\n\ + id=\"defs4\">]\n\ + <linearGradient]\n\ + id=\"linearGradient3166\">]\n\ + <stop]\n\ + id=\"stop3168\"]\n\ + style=\"stop-color:#ffffff;stop-opacity:1\"]\n\ + offset=\"0\" />]\n\ + <stop]\n\ + id=\"stop3170\"]\n\ + style=\"stop-color:#ffff00;stop-opacity:1\"]\n\ + offset=\"1\" />]\n\ + </linearGradient>]\n\ + <linearGradient]\n\ + x1=\"0\"]\n\ + y1=\"22\"]\n\ + x2=\"128\"]\n\ + y2=\"22\"]\n\ + id=\"linearGradient3172\"]\n\ + xlink:href=\"#linearGradient3166\"]\n\ + gradientUnits=\"userSpaceOnUse\" />]\n\ + </defs>]\n\ + <g]\n\ + transform=\"translate(60,54)\"]\n\ + <path]\n\ + d=\"M 64.871323,-38.92647 L 81.371323,-38.92647 L 81.371323,-32.92647 L 77.371323,-32.92647 L 77.371323,-35.92647 L 66.871323,-35.92647\"]\n\ + style=\"fill:#e0e000;fill-opacity:1;stroke:#a08000;stroke-width:1.5;stroke-opacity:1\" />]\n\ + <path]\n\ + d=\"M 64.871323,-11.42647 L 81.371323,-11.42647 L 81.371323,-17.42647 L 77.371323,-17.42647 L 77.371323,-14.42647 L 66.871323,-14.42647\"]\n\ + style=\"fill:#e0e000;fill-opacity:1;stroke:#908000;stroke-width:1.5;stroke-opacity:1\" />]\n\ + </g>]\n\ + <path]\n\ + d=\"M 47,1 C 63,1 120,1 120,1 C 120,1 124.1318,3.4865526 125.5,5 C 126.89747,6.5458243 129,11 129,11 L 129,46 C 129,46 126.78295,49.693654 125.5,51 C 124.07044,52.455629 120,55 120,55 L 47,55 L 47,55 L 47,59 L 27,59 L 27,55 L 10,55 C 10,55 5.9295605,52.455629 4.5,51 C 3.2170498,49.693654 1,46 1,46 L 1,11 C 1,11 3.1025283,6.5458243 4.5,5 C 5.8682021,3.4865526 10,1 10,1 L 27,1 L 27,6 L 47,6 L 47,1 z\"]\n\ + style=\"fill:url(#linearGradient3172);fill-opacity:1;stroke:#c0a000;stroke-width:2;stroke-opacity:1\" />]\n\ + <path]\n\ + d=\"M 13,28 L 18,28 L 18,32 L 24.999999,32 L 24.999999,28 L 116.50001,28 L 116.50001,48 L 24.999999,48 L 24.999999,44 L 18,44 L 18,48 L 13,48 L 13,28 z\"]\n\ + style=\"fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-opacity:1\" />]\n\ + <text]\n\ + style=\"font-size:18px;text-align:center;text-anchor:middle;font-family:Bitstream Vera Sans\">]\n\ + <tspan]\n\ + x=\"65\"]\n\ + y=\"24\"]\n\ + style=\"font-size:18px\">\" + + data1 = \ +"</tspan> \n\ + </text> \n\ +</svg> \n" + + strings = mystring.split(" ",3) + FILE = open(os.path.join("../images", sys.argv[1], mygroup, myname+".svg"), "w") + FILE.write(data0) + FILE.write(mystring.encode("utf-8")) + FILE.write(data1) + FILE.close() + return + +if __name__ == "__main__": + main() |