From 751b1b711747769a92776db974d02bade3fb32bc Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Tue, 01 May 2012 02:35:36 +0000 Subject: autohide blocks on run; autoshow blocks on stop or error; remove show-hide block button --- diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index 73d0aea..f6cc586 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -213,6 +213,7 @@ class LogoCode: x = b.connections[1].values[0] except IndexError: self.tw.showlabel('#nostack') + self.tw.showblocks() return None if type(convert(x, float, False)) == float: if int(float(x)) == x: @@ -403,6 +404,7 @@ class LogoCode: if self.bindex is not None: self.tw.block_list.list[self.bindex].highlight() + self.tw.showblocks() raise logoerror(str(self.iresult)) self.iline = oldiline self.ireturn() @@ -441,6 +443,7 @@ class LogoCode: self.cfun, self.arglist = token, [] if token.nargs == None: + self.tw.showblocks() raise logoerror("#noinput") for i in range(token.nargs): self._no_args_check() @@ -461,6 +464,7 @@ class LogoCode: result = self.cfun.fcn(self, *self.arglist) self.cfun, self.arglist = oldcfun, oldarglist if self.arglist is not None and result == None: + self.tw.showblocks() raise logoerror("%s %s %s" % \ (oldcfun.name, _("did not output to"), self.cfun.name)) self.ireturn(result) @@ -495,6 +499,7 @@ class LogoCode: self.tw.active_turtle.show() return False except logoerror, e: + self.tw.showblocks() self.tw.showlabel('syntaxerror', str(e)[1:-1]) self.tw.turtles.show_all() return False @@ -517,12 +522,14 @@ class LogoCode: errormsg = '' else: errormsg = "%s %s" % (_("I don't know how to"), _(token.name)) + self.tw.showblocks() raise logoerror(errormsg) def _no_args_check(self): """ Missing argument ? """ if self.iline and self.iline[0] is not self.symnothing: return + self.tw.showblocks() raise logoerror("#noinput") # @@ -562,6 +569,7 @@ class LogoCode: elif type(n) == str: return int(ord(n[0])) else: + self.tw.showblocks() raise logoerror("%s %s %s %s" \ % (self.cfun.name, _("doesn't like"), str(n), _("as input"))) diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index b486435..f38f70e 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -317,12 +317,14 @@ class TurtleArtActivity(activity.Activity): def do_hideshow_cb(self, button): ''' Toggle visibility. ''' self.tw.hideshow_button() + ''' if self.tw.hide: # We just hid the blocks. self.blocks_button.set_icon('hideshowon') self.blocks_button.set_tooltip(_('Show blocks')) else: self.blocks_button.set_icon('hideshowoff') self.blocks_button.set_tooltip(_('Hide blocks')) + ''' # Update palette buttons too. if not self.tw.palette: self.do_hidepalette() @@ -331,8 +333,10 @@ class TurtleArtActivity(activity.Activity): def do_hide_blocks(self): ''' Hide blocks. ''' + ''' self.blocks_button.set_icon('hideshowon') self.blocks_button.set_tooltip(_('Show blocks')) + ''' self.do_hidepalette() def do_show_blocks(self): @@ -354,6 +358,8 @@ class TurtleArtActivity(activity.Activity): ''' Callback for run button (rabbit) ''' self.run_button.set_icon('run-faston') self.tw.lc.trace = 0 + # Autohide blocks and palettes on run + self.tw.hideblocks() self.tw.run_button(0) gobject.timeout_add(1000, self.run_button.set_icon, 'run-fastoff') @@ -375,6 +381,8 @@ class TurtleArtActivity(activity.Activity): ''' Callback for stop button. ''' self.stop_turtle_button.set_icon('stopitoff') self.tw.stop_button() + # Auto show blocks after stop + self.tw.showblocks() self.step_button.set_icon('run-slowoff') self.run_button.set_icon('run-fastoff') @@ -839,9 +847,11 @@ class TurtleArtActivity(activity.Activity): self.palette_button = self._add_button( 'paletteoff', _('Hide palette'), self.do_palette_cb, toolbar, _('p')) + ''' self.blocks_button = self._add_button( 'hideshowoff', _('Hide blocks'), self.do_hideshow_cb, toolbar, _('b')) + ''' def _make_project_buttons(self, toolbar): ''' Creates the turtle buttons for both toolbar types''' -- cgit v0.9.1