diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-02 20:29:15 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-02 20:29:15 (GMT) |
commit | cc420f0e37c82275bb5d6b46d85aef9cb9fdae91 (patch) | |
tree | 5f079442bfc0758f3971865da0e78fefc26df2ea /plugins | |
parent | dad6e183fe30339a6bb450ee8e9a02fe534dbb32 (diff) |
update Primitives for the 'while' and 'until' blocks
- They are not yet exportable.
- They only work with loop conditions that consist of only one block like
e.g., 'pen state'.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index ce18907..06a40f4 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -39,7 +39,7 @@ from TurtleArt.tautils import (round_int, debug_output, get_path, hat_on_top, listify, data_from_file) from TurtleArt.tajail import (myfunc, myfunc_import) from TurtleArt.taprimitive import (ArgSlot, ConstantArg, Primitive) -from TurtleArt.tatype import TYPE_STRING +from TurtleArt.tatype import (TYPE_BOOL, TYPE_OBJECT, TYPE_STRING) def _num_type(x): @@ -101,10 +101,14 @@ class Turtle_blocks_extras(Plugin): special_name=_('while'), help_string=_('do-while-True operator that uses \ boolean operators from Numbers palette')) - # Primitive is only used for exporting this block, not for running it self.tw.lc.def_prim('while', 2, Primitive(self.tw.lc.prim_loop, - slot_wrappers={0: Primitive(Primitive.controller_while)}), + arg_descs=[ + ArgSlot(TYPE_OBJECT, + call_arg=False, + wrapper=Primitive(Primitive.controller_while, + arg_descs=[ArgSlot(TYPE_BOOL, call_arg=False)])), + ArgSlot(TYPE_OBJECT)]), True) # internally expanded macro @@ -116,10 +120,15 @@ boolean operators from Numbers palette')) special_name=_('until'), help_string=_('do-until-True operator that uses \ boolean operators from Numbers palette')) - # Primitive is only used for exporting this block, not for running it self.tw.lc.def_prim('until', 2, Primitive(self.tw.lc.prim_loop, - slot_wrappers={0: Primitive(Primitive.controller_until)}), + arg_descs=[ + ArgSlot(TYPE_OBJECT, + call_arg=False, + # TODO can we use controller_while in combination with not_? + wrapper=Primitive(Primitive.controller_until, + arg_descs=[ArgSlot(TYPE_BOOL, call_arg=False)])), + ArgSlot(TYPE_OBJECT)]), True) primitive_dictionary['clamp'] = self._prim_clamp |