diff options
-rw-r--r-- | TurtleArtActivity.py | 39 | ||||
-rw-r--r-- | images/Cartesian.svg | 2 | ||||
-rw-r--r-- | images/polar.svg | 273 | ||||
-rw-r--r-- | tasetup.py | 12 |
4 files changed, 302 insertions, 24 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index 02449d4..4a672c1 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -178,7 +178,7 @@ class TurtleArtActivity(activity.Activity): separator.show() self.coordinates_label = \ - gtk.Label(_("(x,y): ") + "(0,0)") + gtk.Label(_("x") + " 0 " + _("y") + " 0 " + _("heading") + " 0") self.coordinates_label.set_line_wrap(True) self.coordinates_label.show() self.coordinates_toolitem = gtk.ToolItem() @@ -710,23 +710,6 @@ class TurtleArtActivity(activity.Activity): self.step_button.set_icon("run-slowoff") self.run_button.set_icon("run-fastoff") - def _do_Cartesian_cb(self, button): - if self.tw.Cartesian is True: - tawindow.hide(self.tw.Cartesian_coordinates_spr) - self.tw.Cartesian = False - else: - tawindow.setlayer(self.tw.Cartesian_coordinates_spr,700) - self.tw.Cartesian = True - - def _do_polar_cb(self, button): - if self.tw.polar is True: - tawindow.hide(self.tw.polar_coordinates_spr) - self.tw.polar = False - else: - tawindow.setlayer(self.tw.polar_coordinates_spr,700) - self.tw.polar = True - - """ Sample projects open dialog """ def _do_samples_cb(self, button): tawindow.load_file(self.tw, True) @@ -752,6 +735,26 @@ class TurtleArtActivity(activity.Activity): self.recenter() """ + Display coordinate grids + """ + def _do_Cartesian_cb(self, button): + if self.tw.Cartesian is True: + tawindow.hide(self.tw.Cartesian_coordinates_spr) + self.tw.Cartesian = False + else: + tawindow.setlayer(self.tw.Cartesian_coordinates_spr,610) + self.tw.Cartesian = True + + def _do_polar_cb(self, button): + if self.tw.polar is True: + tawindow.hide(self.tw.polar_coordinates_spr) + self.tw.polar = False + else: + tawindow.setlayer(self.tw.polar_coordinates_spr,610) + self.tw.polar = True + + + """ Either set up initial share... """ def _shared_cb(self, activity): diff --git a/images/Cartesian.svg b/images/Cartesian.svg index dc06f3d..7a29e22 100644 --- a/images/Cartesian.svg +++ b/images/Cartesian.svg @@ -125,6 +125,7 @@ <path d="M 100,440 L 100,460" style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> +<!-- <text style="font-size:20px;font-style:normal;font-weight:normal;fill:#0000FF;fill-opacity:1;stroke:none;text-anchor:middle;text-align:center;font-family:Bitstream Vera Sans"><tspan x="95" @@ -205,5 +206,6 @@ style="font-size:20px;font-style:normal;font-weight:normal;fill:#00AA00;fill-opacity:1;stroke:none;text-anchor:end;text-align:end;font-family:Bitstream Vera Sans"><tspan x="590" y="858">–400</tspan></text> +--> </g> </svg> diff --git a/images/polar.svg b/images/polar.svg new file mode 100644 index 0000000..6a5f841 --- /dev/null +++ b/images/polar.svg @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.0" + width="1200" + height="900" + id="svg2"> + <defs + id="defs4" /> + <path + d="M 899.66703,-69.03853 L 300.33297,969.03853" + id="path3403" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 600,-149.33408 L 600,1049.3341" + id="path69" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 300.33297,-69.03853 L 899.66703,969.03853" + id="path3397" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 176.2068,26.20681 L 1023.7932,873.79319" + id="path3405" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 80.961482,150.33296 L 1119.0385,749.66704" + id="path3399" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 881.14902,435.72711 C 881.14902,630.2662 723.92622,787.97129 529.98206,787.97129 C 336.03789,787.97129 178.81509,630.2662 178.81509,435.72711 C 178.81509,241.18802 336.03789,83.482931 529.98205,83.482931 C 723.92622,83.482931 881.14902,241.18802 881.14902,435.72711 L 881.14902,435.72711 z" + transform="matrix(1.1334197,0,0,1.1299535,-0.6921025,-42.351375)" + id="path2537" + style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.88363791;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 881.14902,435.72711 C 881.14902,630.2662 723.92622,787.97129 529.98206,787.97129 C 336.03789,787.97129 178.81509,630.2662 178.81509,435.72711 C 178.81509,241.18802 336.03789,83.482931 529.98205,83.482931 C 723.92622,83.482931 881.14902,241.18802 881.14902,435.72711 L 881.14902,435.72711 z" + transform="matrix(0.8500647,0,0,0.8474652,149.48096,80.736436)" + id="path3311" + style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.17818391;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 881.14902,435.72711 C 881.14902,630.2662 723.92622,787.97129 529.98206,787.97129 C 336.03789,787.97129 178.81509,630.2662 178.81509,435.72711 C 178.81509,241.18802 336.03789,83.482931 529.98205,83.482931 C 723.92622,83.482931 881.14902,241.18802 881.14902,435.72711 L 881.14902,435.72711 z" + transform="matrix(0.5667098,0,0,0.5649768,299.65398,203.82429)" + id="path3313" + style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.76727581;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 881.14902,435.72711 C 881.14902,630.2662 723.92622,787.97129 529.98206,787.97129 C 336.03789,787.97129 178.81509,630.2662 178.81509,435.72711 C 178.81509,241.18802 336.03789,83.482931 529.98205,83.482931 C 723.92622,83.482931 881.14902,241.18802 881.14902,435.72711 L 881.14902,435.72711 z" + transform="matrix(0.2833549,0,0,0.2824884,449.82699,326.91215)" + id="path3315" + style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3.53455162;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 881.14902,435.72711 C 881.14902,630.2662 723.92622,787.97129 529.98206,787.97129 C 336.03789,787.97129 178.81509,630.2662 178.81509,435.72711 C 178.81509,241.18802 336.03789,83.482931 529.98205,83.482931 C 723.92622,83.482931 881.14902,241.18802 881.14902,435.72711 L 881.14902,435.72711 z" + transform="matrix(1.4220377,0,0,1.417689,-153.65446,-167.72553)" + id="path3395" + style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.70429397;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 0,450 L 1200,450" + id="path49" + style="fill:none;stroke:#aaaaaa;stroke-width:1px;stroke-opacity:1" /> +<!-- + <text + id="text105" + style="font-size:20px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"> + <tspan + x="700" + y="480" + id="tspan107">100</tspan> + </text> + <text + id="text109" + style="font-size:20px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"> + <tspan + x="800" + y="480" + id="tspan111">200</tspan> + </text> + <text + id="text113" + style="font-size:20px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"> + <tspan + x="900" + y="480" + id="tspan115">300</tspan> + </text> + <text + id="text117" + style="font-size:20px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"> + <tspan + x="1000" + y="480" + id="tspan119">400</tspan> + </text> + <text + id="text121" + style="font-size:20px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"> + <tspan + x="1100" + y="480" + id="tspan123">500</tspan> + </text> +--> + <path + d="M 80.96149,749.66704 L 1119.0385,150.33296" + id="path3401" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 1023.7932,26.20681 L 176.2068,873.79319" + id="path3407" + style="fill:none;stroke:#aaaaaa;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> +<!-- + <text + x="593.71545" + y="243.75009" + id="text3409" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="593.71545" + y="243.75009" + id="tspan3411" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">0</tspan></text> + <text + x="694.31061" + y="271.75113" + id="text3413" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="694.31061" + y="271.75113" + id="tspan3415" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">30</tspan></text> + <text + x="735.44513" + y="305.70435" + id="text3417" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="735.44513" + y="305.70435" + id="tspan3419" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">45</tspan></text> + <text + x="773.53778" + y="351.4249" + id="text3421" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="773.53778" + y="351.4249" + id="tspan3423" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">60</tspan></text> + <text + x="802.28174" + y="455.84259" + id="text3425" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="802.28174" + y="455.84259" + id="tspan3427" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">90</tspan></text> + <text + x="771.25879" + y="568.39978" + id="text3429" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="771.25879" + y="568.39978" + id="tspan3431" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">120</tspan></text> + <text + x="735.16608" + y="611.58545" + id="text3433" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="735.16608" + y="611.58545" + id="tspan3435" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">135</tspan></text> + <text + x="689.05011" + y="643.14337" + id="text3437" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="689.05011" + y="643.14337" + id="tspan3439" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">150</tspan></text> + <text + x="581.42322" + y="667.88727" + id="text3441" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="581.42322" + y="667.88727" + id="tspan3443" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">180</tspan></text> + <text + x="473.40085" + y="642.6084" + id="text3445" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="473.40085" + y="642.6084" + id="tspan3447" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">210</tspan></text> + <text + x="427.6803" + y="611.05054" + id="text3449" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="427.6803" + y="611.05054" + id="tspan3451" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">225</tspan></text> + <text + x="388.12244" + y="564.39978" + id="text3453" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="388.12244" + y="564.39978" + id="tspan3455" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">240</tspan></text> + <text + x="358.44824" + y="456.91229" + id="text3457" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="358.44824" + y="456.91229" + id="tspan3459" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">270</tspan></text> + <text + x="390.12247" + y="347.4249" + id="text3461" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="390.12247" + y="347.4249" + id="tspan3463" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">300</tspan></text> + <text + x="429.28494" + y="302.77408" + id="text3465" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="429.28494" + y="302.77408" + id="tspan3467" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">315</tspan></text> + <text + x="473.54037" + y="271.21625" + id="text3469" + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"><tspan + x="473.54037" + y="271.21625" + id="tspan3471" + style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff0000;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">330</tspan></text> +--> +</svg> @@ -274,15 +274,15 @@ def setup_misc(tw): tw.media_shapes['pythonloaded'] = \ load_image(tw.path_lang, 'sensors', 'nop-loaded') # coordinare systems - tw.Cartesian_coordinates_spr = sprNew(tw, 0, 0, load_image(tw.path, '', \ - "Cartesian")) + tw.Cartesian_coordinates_spr = sprNew(tw, tw.width/2-600, tw.height/2-450, \ + load_image(tw.path, '', "Cartesian")) tw.Cartesian_coordinates_spr.type = 'coordinates' - setlayer(tw.Cartesian_coordinates_spr, 700) + setlayer(tw.Cartesian_coordinates_spr, 610) hide(tw.Cartesian_coordinates_spr) - tw.polar_coordinates_spr = sprNew(tw, 0, 0, load_image(tw.path, '', \ - "polar")) + tw.polar_coordinates_spr = sprNew(tw, tw.width/2-600, tw.height/2-450, \ + load_image(tw.path, '', "polar")) tw.polar_coordinates_spr.type = 'coordinates' - setlayer(tw.polar_coordinates_spr, 700) + setlayer(tw.polar_coordinates_spr, 610) hide(tw.polar_coordinates_spr) # status shapes get positioned at the bottom of the screen tw.status_shapes = {} |