Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-05-12 12:33:07 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-05-12 12:33:07 (GMT)
commita01b019f06771ba88db68d01fab32774049603ed (patch)
treeda56392ee72e51802366e099e8a5a66416ddccd4
parent10d1cbeb364a3ac07a7a1c56bc2b6963627c7f10 (diff)
blank coordinate view when running with rabbit (#3599)
-rw-r--r--TurtleArt/talogo.py7
-rw-r--r--TurtleArt/tawindow.py37
-rw-r--r--TurtleArtActivity.py2
-rwxr-xr-xturtleblocks.py2
4 files changed, 37 insertions, 11 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 1e5bf07..422d4f9 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -415,6 +415,7 @@ class LogoCode:
if self.bindex is not None:
self.tw.block_list.list[self.bindex].highlight()
self.tw.showblocks()
+ self.tw.display_coordinates()
raise logoerror(str(self.iresult))
self.iline = oldiline
self.ireturn()
@@ -454,6 +455,7 @@ class LogoCode:
if token.nargs == None:
self.tw.showblocks()
+ self.tw.display_coordinates()
raise logoerror("#noinput")
for i in range(token.nargs):
self._no_args_check()
@@ -510,6 +512,7 @@ class LogoCode:
return False
except logoerror, e:
self.tw.showblocks()
+ self.tw.display_coordinates()
self.tw.showlabel('syntaxerror', str(e))
self.tw.turtles.show_all()
return False
@@ -540,6 +543,7 @@ class LogoCode:
if self.iline and self.iline[0] is not self.symnothing:
return
self.tw.showblocks()
+ self.tw.display_coordinates()
raise logoerror("#noinput")
#
@@ -755,6 +759,9 @@ class LogoCode:
# manage the connections and flows locally means we may run
# into trouble if any of these block types (forever, while,
# until. ifelse, stopstack, or stack) is changed in tablock.py
+
+ # TODO: Detect nesting, e.g., forever while
+
if b.name == 'while':
while_blk = True
else:
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index d2b408d..2d4c38e 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -1334,15 +1334,20 @@ class TurtleArtWindow():
if spr.name == 'run-fastoff':
self.lc.trace = 0
self.hideblocks()
+ self.display_coordinates(clear=True)
self.run_button(0)
elif spr.name == 'run-slowoff':
self.lc.trace = 1
+ self.showblocks()
self.run_button(3)
elif spr.name == 'debugoff':
self.lc.trace = 1
+ self.showblocks()
self.run_button(6)
elif spr.name == 'stopiton':
self.stop_button()
+ self.display_coordinates()
+ self.showblocks()
self.toolbar_shapes['stopiton'].hide()
elif spr.name == 'eraseron':
self.eraser_button()
@@ -3168,18 +3173,28 @@ class TurtleArtWindow():
self.canvas.shade, self.canvas.pensize))
return _data
- def display_coordinates(self):
+ def display_coordinates(self, clear=False):
""" Display the coordinates of the current turtle on the toolbar """
- x = round_int(float(self.canvas.xcor) / self.coord_scale)
- y = round_int(float(self.canvas.ycor) / self.coord_scale)
- h = round_int(self.canvas.heading)
- if self.running_sugar:
- self.activity.coordinates_label.set_text("%s: %d %s: %d %s: %d" %\
- (_("xcor"), x, _("ycor"), y, _("heading"), h))
- self.activity.coordinates_label.show()
- elif self.interactive_mode:
- self.parent.set_title("%s — %s: %d %s: %d %s: %d" % \
- (_("Turtle Art"), _("xcor"), x, _("ycor"), y, _("heading"), h))
+ if clear:
+ if self.running_sugar:
+ self.activity.coordinates_label.set_text('')
+ self.activity.coordinates_label.show()
+ elif self.interactive_mode:
+ self.parent.set_title('')
+ else:
+ x = round_int(float(self.canvas.xcor) / self.coord_scale)
+ y = round_int(float(self.canvas.ycor) / self.coord_scale)
+ h = round_int(self.canvas.heading)
+ if self.running_sugar:
+ self.activity.coordinates_label.set_text(
+ "%s: %d %s: %d %s: %d" % (_("xcor"), x, _("ycor"), y,
+ _("heading"), h))
+ self.activity.coordinates_label.show()
+ elif self.interactive_mode:
+ self.parent.set_title(
+ "%s — %s: %d %s: %d %s: %d" % (
+ _("Turtle Art"), _("xcor"), x, _("ycor"), y,
+ _("heading"), h))
def showlabel(self, shp, label=''):
""" Display a message on a status block """
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 0056ade..5503482 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -335,6 +335,7 @@ class TurtleArtActivity(activity.Activity):
self.tw.lc.trace = 0
# Autohide blocks and palettes on run
self.tw.hideblocks()
+ self.tw.display_coordinates(clear=True)
self.tw.run_button(0, running_from_button_push=True)
gobject.timeout_add(1000, self.run_button.set_icon, 'run-fastoff')
@@ -359,6 +360,7 @@ class TurtleArtActivity(activity.Activity):
self.tw.stop_button()
# Auto show blocks after stop
self.tw.showblocks()
+ self.tw.display_coordinates()
self.step_button.set_icon('run-slowoff')
self.run_button.set_icon('run-fastoff')
diff --git a/turtleblocks.py b/turtleblocks.py
index 5386a9d..7deb92e 100755
--- a/turtleblocks.py
+++ b/turtleblocks.py
@@ -546,6 +546,7 @@ class TurtleMain():
''' Callback for run button (rabbit). '''
self.tw.lc.trace = 0
self.tw.hideblocks()
+ self.tw.display_coordinates(clear=True)
self.tw.run_button(0, running_from_button_push=True)
return
@@ -565,6 +566,7 @@ class TurtleMain():
''' Callback for stop button. '''
self.tw.lc.trace = 0
self.tw.stop_button()
+ self.tw.display_coordinates()
return
def _do_copy_cb(self, button):