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-15 11:50:40 (GMT)
committer Marion <marion.zepf@gmail.com>2013-08-15 11:50:40 (GMT)
commit6998299fef2fbe1585e170b6732737ddc981c7ea (patch)
tree4d3c10d6d0a3df1d731f2ac3c9a058849cc35ccd /TurtleArt/tabasics.py
parent89099d7b2daaba664a4cef5e103c00b9bf0c8314 (diff)
add Primitive for the 'mod' block
- When skipping a slot wrapper that has call_me == False or export_me == False, still apply the wrappers contained in it. - Automatically convert Colors to numbers for mathematical operators.
Diffstat (limited to 'TurtleArt/tabasics.py')
-rw-r--r--TurtleArt/tabasics.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py
index 97ce4fd..b0f1e54 100644
--- a/TurtleArt/tabasics.py
+++ b/TurtleArt/tabasics.py
@@ -675,7 +675,6 @@ minus :y\nend\n')
blocks'))
self.tw.lc.def_prim('id', 1, Primitive(Primitive.identity))
- primitive_dictionary['remainder'] = self._prim_mod
palette.add_block('remainder2',
style='number-style-porch',
label=_('mod'),
@@ -684,8 +683,18 @@ blocks'))
logo_command='remainder',
help_string=_('modular (remainder) operator'))
self.tw.lc.def_prim('remainder', 2,
- lambda self, x, y:
- primitive_dictionary['remainder'](x, y))
+ Primitive(Primitive.modulo, slot_wrappers={
+ 0: Primitive(self.check_number,
+ export_me=False,
+ slot_wrappers={
+ 0: self.prim_cache["convert_to_number"]}),
+ 1: Primitive(self.check_non_zero,
+ export_me=False,
+ slot_wrappers={
+ 0: Primitive(self.check_number,
+ export_me=False,
+ slot_wrappers={
+ 0: self.prim_cache["convert_to_number"]})})}))
palette.add_block('sqrt',
style='number-style-1arg',