diff options
Diffstat (limited to 'plugins/turtle_blocks_extras/turtle_blocks_extras.py')
-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 |