From 5463687e5e8a07a22f2f93e1f03c4982a2c7b22c Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 17 Oct 2009 14:00:32 +0000 Subject: Cartesian coordinates overlay --- 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 @@ + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + –500 + –400 + –300 + –200 + –100 + x + 100 + 200 + 300 + 400 + 500 + 400 + 300 + 200 + 100 + y + –100 + –200 + –300 + –400 + + diff --git a/tasetup.py b/tasetup.py index 77c5be9..eac041e 100644 --- a/tasetup.py +++ b/tasetup.py @@ -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 # -- cgit v0.9.1