Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tabasics.py
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-08-04 15:18:06 (GMT)
committer Marion <marion.zepf@gmail.com>2013-08-04 15:18:06 (GMT)
commitd7da80ca0f67617d5c305aed1ef66e12e4d43e69 (patch)
tree9fc0413f6e2c36bd6cead819558a383d319bfa2d /TurtleArt/tabasics.py
parent1445dc528d9c03d720918d11424e8ea9b02b5ecf (diff)
introduce the call_me attr to Primitives, it's parallel to export_me
- If the Primitive is supposed to be called (as a slot wrapper or constant argument of another Primitive) and call_me is True, the Primitive is called and its return value is passed on to its parent Primitive. - If call_me is False, the Primitive object itself is passed on to its parent Primitive.
Diffstat (limited to 'TurtleArt/tabasics.py')
-rw-r--r--TurtleArt/tabasics.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py
index b4db1ea..0181109 100644
--- a/TurtleArt/tabasics.py
+++ b/TurtleArt/tabasics.py
@@ -72,7 +72,7 @@ from tapalette import (make_palette, define_logo_function)
from talogo import (primitive_dictionary, logoerror)
from tautils import (convert, chr_to_ord, round_int, strtype)
from taconstants import (COLORDICT, CONSTANTS)
-from taprimitive import (Primitive, PrimitiveCall)
+from taprimitive import Primitive
from taturtle import Turtle
@@ -170,10 +170,11 @@ turtle'))
'clean',
0,
Primitive(Primitive.group, constant_args={0: [
- Primitive(self.tw.clear_plugins),
- Primitive(self.tw.lc.prim_clear_helper, export_me=False),
- Primitive(self.tw.canvas.clearscreen),
- Primitive(self.tw.turtles.reset_turtles)]}))
+ Primitive(self.tw.clear_plugins, call_me=False),
+ Primitive(self.tw.lc.prim_clear_helper, call_me=False,
+ export_me=False),
+ Primitive(self.tw.canvas.clearscreen, call_me=False),
+ Primitive(self.tw.turtles.reset_turtles, call_me=False)]}))
palette.add_block('left',
style='basic-style-1arg',
@@ -269,10 +270,10 @@ the turtle (can be used in place of a number block)'),
'xcor',
0,
Primitive(Primitive.divide, constant_args={
- 0: PrimitiveCall(Turtle.get_x, constant_args={
- 0: PrimitiveCall(self.tw.turtles.get_active_turtle,
- export_me=False)}),
- 1: PrimitiveCall(self.tw.get_coord_scale)}))
+ 0: Primitive(Turtle.get_x, constant_args={
+ 0: Primitive(self.tw.turtles.get_active_turtle,
+ export_me=False)}),
+ 1: Primitive(self.tw.get_coord_scale)}))
palette.add_block('ycor',
style='box-style',
@@ -286,10 +287,10 @@ the turtle (can be used in place of a number block)'),
'ycor',
0,
Primitive(Primitive.divide, constant_args={
- 0: PrimitiveCall(Turtle.get_y, constant_args={
- 0: PrimitiveCall(self.tw.turtles.get_active_turtle,
+ 0: Primitive(Turtle.get_y, constant_args={
+ 0: Primitive(self.tw.turtles.get_active_turtle,
export_me=False)}),
- 1: PrimitiveCall(self.tw.get_coord_scale)}))
+ 1: Primitive(self.tw.get_coord_scale)}))
palette.add_block('heading',
style='box-style',
@@ -821,7 +822,8 @@ number of seconds'))
help_string=_('loops forever'))
self.tw.lc.def_prim('forever', 1,
Primitive(self.tw.lc.loop,
- constant_args={0: Primitive(Primitive.controller_forever)}),
+ constant_args={0: Primitive(Primitive.controller_forever,
+ call_me=False)}),
True)
primitive_dictionary['repeat'] = self._prim_repeat