diff options
author | Marion <marion.zepf@gmail.com> | 2013-08-15 17:00:09 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-08-15 17:00:09 (GMT) |
commit | 1a7a10d0708772e866b992cd760c63081afe2417 (patch) | |
tree | b00e190f9d04a2c3cc3016c139c3fd7e224f328e /TurtleArt/tabasics.py | |
parent | 1b7d261835dd27e686067a2e95ac99ceb64a36dd (diff) |
add Primitives for all 'box' and 'store-in' blocks (not yet exportable)
- Move the backend for getting and setting boxes to talogo (from
tabasics and tawindow).
- Simplify internal box naming scheme: convert integers to floats
instead of floats to integers.
Diffstat (limited to 'TurtleArt/tabasics.py')
-rw-r--r-- | TurtleArt/tabasics.py | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index 3aab25f..ddaf1c2 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -983,7 +983,7 @@ buttons')) help_string=_('invokes named action stack')) self.tw.lc.def_prim('stack', 1, primitive_dictionary['stack'], True) - primitive_dictionary['setbox'] = self._prim_setbox + primitive_dictionary['setbox'] = Primitive(self.tw.lc.prim_set_box) palette.add_block('storeinbox1', hidden=True, style='basic-style-1arg', @@ -994,9 +994,7 @@ buttons')) logo_command='make "box1', help_string=_('stores numeric value in Variable 1')) self.tw.lc.def_prim('storeinbox1', 1, - lambda self, x: - primitive_dictionary['setbox'] - ('box1', None, x)) + Primitive(self.tw.lc.prim_set_box, constant_args={0: 'box1'})) palette.add_block('storeinbox2', hidden=True, @@ -1008,9 +1006,7 @@ buttons')) logo_command='make "box2', help_string=_('stores numeric value in Variable 2')) self.tw.lc.def_prim('storeinbox2', 1, - lambda self, x: - primitive_dictionary['setbox'] - ('box2', None, x)) + Primitive(self.tw.lc.prim_set_box, constant_args={0: 'box2'})) palette.add_block('box1', hidden=True, @@ -1020,7 +1016,8 @@ buttons')) logo_command=':box1', help_string=_('Variable 1 (numeric value)'), value_block=True) - self.tw.lc.def_prim('box1', 0, lambda self: self.tw.lc.boxes['box1']) + self.tw.lc.def_prim('box1', 0, + Primitive(self.tw.lc.prim_get_box, constant_args={0: 'box1'})) palette.add_block('box2', hidden=True, @@ -1030,7 +1027,8 @@ buttons')) logo_command=':box2', help_string=_('Variable 2 (numeric value)'), value_block=True) - self.tw.lc.def_prim('box2', 0, lambda self: self.tw.lc.boxes['box2']) + self.tw.lc.def_prim('box2', 0, + Primitive(self.tw.lc.prim_get_box, constant_args={0: 'box2'})) palette.add_block('storein', style='basic-style-2arg', @@ -1042,11 +1040,9 @@ buttons')) help_string=_('stores numeric value in named \ variable')) self.tw.lc.def_prim('storeinbox', 2, - lambda self, x, y: - primitive_dictionary['setbox'] - ('box3', x, y)) + Primitive(self.tw.lc.prim_set_box)) - primitive_dictionary['box'] = self._prim_box + primitive_dictionary['box'] = Primitive(self.tw.lc.prim_get_box) palette.add_block('box', style='number-style-1strarg', hidden=True, @@ -1058,7 +1054,7 @@ variable')) value_block=True, help_string=_('named variable (numeric value)')) self.tw.lc.def_prim('box', 1, - lambda self, x: primitive_dictionary['box'](x)) + Primitive(self.tw.lc.prim_get_box)) palette.add_block('hat1', hidden=True, |