Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-12-22 14:51:43 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-12-22 14:51:43 (GMT)
commit235a2cb3be521a704ebf0eda8fa30e30811cda27 (patch)
tree0d0d0d2225978f2aea459b6d2556225f6dc8ee0d
parent42b0d5f71cbd348ee85b356727c75869c20c7440 (diff)
stub for while blockv130
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index 2ffa3c1..d512f54 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -93,6 +93,19 @@ class Turtle_blocks_extras(Plugin):
colors=["#FFC000", "#A08000"],
help_string=_('Palette of flow operators'))
+ '''
+ primitive_dictionary['while'] = self._prim_while
+ palette.add_block('while',
+ style='flow-style-boolean',
+ label=[_('while'), ' ', ' '],
+ prim_name='while',
+ default=[None, None, 'vspace'],
+ special_name=_('while'),
+ help_string=_('do-while-True operator that uses \
+boolean operators from Numbers palette'))
+ self.tw.lc.def_prim('while', 2, primitive_dictionary['while'], True)
+ '''
+
# macro
palette.add_block('while',
style='flow-style-boolean',
@@ -464,7 +477,7 @@ advanced single-variable math equations, e.g., sin(x)'))
hidden=True,
colors=["#FF0000", "#A00000"],
style='number-style-var-arg',
- label=[_('Python'), 'f(x,y)', 'x'],
+ label=[_('Python'), 'f(x,y)', ' '],
prim_name='myfunction2',
default=['x+y', 100, 100],
help_string=_('a programmable block: used to add \
@@ -477,7 +490,7 @@ advanced multi-variable math equations, e.g., sqrt(x*x+y*y)'))
hidden=True,
colors=["#FF0000", "#A00000"],
style='number-style-var-arg',
- label=[_('Python'), 'f(x,y,z)', 'x'],
+ label=[_('Python'), 'f(x,y,z)', ' '],
prim_name='myfunction3',
default=['x+y+z', 100, 100, 100],
help_string=_('a programmable block: used to add \
@@ -1265,6 +1278,21 @@ bullets'))
self.tw.lc.update_label_value('time', elapsed_time)
return elapsed_time
+ '''
+ def _prim_while(self, boolean, blklist): """ Repeat while true:
+ won't work as coded as boolean is only calculated once. """
+
+ while(True):
+ if not boolean:
+ break
+ self.tw.lc.icall(self.tw.lc.evline, blklist[:])
+ yield True
+ if self.tw.lc.procstop:
+ break
+ self.tw.lc.ireturn()
+ yield True
+ '''
+
# Deprecated blocks
def _prim_t1x1(self, title, media):