From 4e70ec09fe8ebe4cacb8c0f494b3c1eb7b4a0fc6 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 22 Mar 2013 11:35:49 +0000 Subject: restructure for staging export python --- diff --git a/TurtleArt/taexportlogo.py b/TurtleArt/taexportlogo.py index 7d7d1cb..58bd1ec 100644 --- a/TurtleArt/taexportlogo.py +++ b/TurtleArt/taexportlogo.py @@ -265,7 +265,6 @@ def _walk_stack(tw, blk_in_stack): top = find_top_block(blk_in_stack) if blk_in_stack == top: - psuedocode = tw.lc.run_blocks(top, tw.just_blocks(), False) - return psuedocode + return tw.lc.generate_code(top, tw.just_blocks()) else: return [] diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index 158857a..d8adca6 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -22,7 +22,7 @@ #THE SOFTWARE. import gtk -from time import time +from time import time, sleep from operator import isNumberType from UserDict import UserDict @@ -188,8 +188,11 @@ class LogoCode: self.oblist[string] = sym return sym - def run_blocks(self, blk, blocks, run_flag): - """ Given a block to run... """ + def run_blocks(self, code): + self.start_time = time() + self._setup_cmd(code) + + def generate_code(self, blk, blocks): for k in self.stacks.keys(): self.stacks[k] = None self.stacks['stack1'] = None @@ -264,12 +267,7 @@ class LogoCode: if b[3] is not None: b[0].connections[-2].connections[b[3]] = b[0] - if run_flag: - # debug_output("running code: %s" % (code), self.tw.running_sugar) - self.start_time = time() - self._setup_cmd(code) - else: - return code + return code def _blocks_to_code(self, blk): """ Convert a stack of blocks to pseudocode. """ @@ -420,6 +418,7 @@ class LogoCode: self.tw.active_turtle.show() endtime = _millisecond() + self.tw.step_time * 100. while _millisecond() < endtime: + sleep(0.1) yield True self.tw.active_turtle.hide() -- cgit v0.9.1