diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2009-10-17 14:00:32 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2009-10-17 14:00:32 (GMT) |
commit | 5463687e5e8a07a22f2f93e1f03c4982a2c7b22c (patch) | |
tree | ce2506966a8e6d42ecfcfec5809c9f277db8caea | |
parent | af1cf67fb043e133e57a18f142c0e9d576646cb5 (diff) |
Cartesian coordinates overlay
-rw-r--r-- | TurtleArtActivity.py | 17 | ||||
-rw-r--r-- | icons/view-Cartesian.svg | 30 | ||||
-rw-r--r-- | images/Cartesian.svg | 209 | ||||
-rw-r--r-- | tasetup.py | 6 | ||||
-rw-r--r-- | tawindow.py | 1 |
5 files changed, 262 insertions, 1 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index 129d17d..b4d4b23 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -151,7 +151,7 @@ class TurtleArtActivity(activity.Activity): toolbar_box.toolbar.insert(edit_toolbar_button, -1) edit_toolbar_button.show() - # The view toolbar -- just full screen + # The view toolbar view_toolbar = gtk.Toolbar() fullscreen_button = ToolButton('view-fullscreen') fullscreen_button.set_tooltip(_("Fullscreen")) @@ -160,6 +160,12 @@ class TurtleArtActivity(activity.Activity): view_toolbar.insert(fullscreen_button,-1) fullscreen_button.show() + Cartesian_button = ToolButton('view-Cartesian') + Cartesian_button.set_tooltip(_("Cartesian coordinates")) + Cartesian_button.connect('clicked', self._do_Cartesian_cb) + view_toolbar.insert(Cartesian_button,-1) + Cartesian_button.show() + view_toolbar_button = ToolbarButton( page=view_toolbar, icon_name='toolbar-view') @@ -684,6 +690,15 @@ 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 + + """ Sample projects open dialog """ def _do_samples_cb(self, button): tawindow.load_file(self.tw, True) diff --git a/icons/view-Cartesian.svg b/icons/view-Cartesian.svg new file mode 100644 index 0000000..3d0e210 --- /dev/null +++ b/icons/view-Cartesian.svg @@ -0,0 +1,30 @@ +<?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="55" + height="55" + id="svg2384"> + <defs + id="defs2386" /> + <g + id="layer1"> + <rect + width="50" + height="50" + x="2.5" + y="2.5" + id="rect2394" + style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3.5;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 27.333333,1 C 28.083333,50.75 27.333333,54 27.333333,54" + id="path3168" + style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + d="M 54,27.333333 C 4.2499997,28.083333 1,27.333333 1,27.333333" + id="path3170" + style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + </g> +</svg> diff --git a/images/Cartesian.svg b/images/Cartesian.svg new file mode 100644 index 0000000..dc06f3d --- /dev/null +++ b/images/Cartesian.svg @@ -0,0 +1,209 @@ +<?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" /> + <g + id="layer1"> + <path + d="M 0,850 L 1200,850" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,750 L 1200,750" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,650 L 1200,650" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,550 L 1200,550" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,350 L 1200,350" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,250 L 1200,250" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,150 L 1200,150" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,50 L 1200,50" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 1100,0 L 1100,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 1000,0 L 1000,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 900,0 L 900,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 800,0 L 800,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 700,0 L 700,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 500,0 L 500,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 400,0 L 400,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 300,0 L 300,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 200,0 L 200,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 100,0 L 100,900" + style="fill:none;stroke:#AAAAAA;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,850 L 610,850" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,750 L 610,750" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,650 L 610,650" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,550 L 610,550" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 0,450 L 1200,450" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,350 L 610,350" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,250 L 610,250" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,150 L 610,150" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 590,50 L 610,50" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 1100,440 L 1100,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 1000,440 L 1000,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 900,440 L 900,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 800,440 L 800,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 700,440 L 700,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 600,0 L 600,900" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 500,440 L 500,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 400,440 L 400,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 300,440 L 300,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <path + d="M 200,440 L 200,460" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-opacity:1" /> + <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" + y="480">–500</tspan></text> + <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="195" + y="480">–400</tspan></text> + <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="295" + y="480">–300</tspan></text> + <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="395" + y="480">–200</tspan></text> + <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="495" + y="480">–100</tspan></text> + <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="650" + y="480">x</tspan></text> + <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="700" + y="480">100</tspan></text> + <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="800" + y="480">200</tspan></text> + <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="900" + y="480">300</tspan></text> + <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="1000" + y="480">400</tspan></text> + <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="1100" + y="480">500</tspan></text> + <text + 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="58">400</tspan></text> + <text + 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="158">300</tspan></text> + <text + 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="258">200</tspan></text> + <text + 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="358">100</tspan></text> + <text + 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="408">y</tspan></text> + <text + 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="558">–100</tspan></text> + <text + 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="658">–200</tspan></text> + <text + 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="758">–300</tspan></text> + <text + 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> @@ -273,6 +273,12 @@ def setup_misc(tw): # media blocks that replace other blocks 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.type = 'coordinates' + setlayer(tw.Cartesian_coordinates_spr, 700) + hide(tw.Cartesian_coordinates_spr) # status shapes get positioned at the bottom of the screen tw.status_shapes = {} tw.status_shapes['status'] = load_image(tw.path, '', 'status') diff --git a/tawindow.py b/tawindow.py index 0578909..30ba715 100644 --- a/tawindow.py +++ b/tawindow.py @@ -136,6 +136,7 @@ def twNew(win, path, lang, parent=None): tw.buddies = [] tw.dx = 0 tw.dy = 0 + tw.Cartesian = False return tw # |