Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/taexportpython.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/taexportpython.py')
-rw-r--r--TurtleArt/taexportpython.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/TurtleArt/taexportpython.py b/TurtleArt/taexportpython.py
index c87757d..88a73a0 100644
--- a/TurtleArt/taexportpython.py
+++ b/TurtleArt/taexportpython.py
@@ -31,7 +31,7 @@ import util.codegen as codegen
from talogo import LogoCode
from taprimitive import (Primitive, PyExportError, value_to_ast)
-from tautils import (debug_output, find_group, find_top_block)
+from tautils import (debug_output, find_group, find_top_block, get_stack_name)
@@ -93,10 +93,11 @@ def save_python(tw):
snippets = [_SETUP_CODE_START]
for block in tops_of_stacks:
- # TODO name of action stack?
- pythoncode = _action_stack_to_python(block, tw.lc)
- snippets.append(pythoncode)
- snippets.append(linesep)
+ stack_name = get_stack_name(block)
+ if stack_name:
+ pythoncode = _action_stack_to_python(block, tw.lc, name=stack_name)
+ snippets.append(pythoncode)
+ snippets.append(linesep)
snippets.append(_SETUP_CODE_END)
return "".join(snippets)
@@ -164,7 +165,7 @@ def _walk_action_stack(top_block, lc):
block=block)
if isinstance(new_ast, (list, tuple)):
ast_list.extend(new_ast)
- else:
+ elif new_ast is not None:
ast_list.append(new_ast)
elif arg_asts:
new_ast = ast.List(elts=arg_asts, ctx=ast.Load)