From a01b019f06771ba88db68d01fab32774049603ed Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 12 May 2012 12:33:07 +0000 Subject: blank coordinate view when running with rabbit (#3599) --- (limited to 'TurtleArt') 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 """ -- cgit v0.9.1