From 970dcc47fdc03cceef3421211f5394790fbac794 Mon Sep 17 00:00:00 2001 From: Pootle daemon Date: Wed, 22 Aug 2012 15:55:29 +0000 Subject: Merge branch 'master' of git.sugarlabs.org:turtleart/mainline --- diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index f3b0d8f..ff9eebe 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -513,6 +513,7 @@ make "tmp first :taheap\rmake "taheap butfirst :taheap\routput :tmp\rend\r') primitive_dictionary['isheapempty'] = self._prim_is_heap_empty palette.add_block('isheapempty', + hidden=True, style='box-style', label=_('empty heap?'), prim_name='isheapempty', @@ -521,6 +522,16 @@ make "tmp first :taheap\rmake "taheap butfirst :taheap\routput :tmp\rend\r') self.tw.lc.def_prim('isheapempty', 0, lambda self: primitive_dictionary['isheapempty']()) + primitive_dictionary['isheapempty2'] = self._prim_is_heap_empty_bool + palette.add_block('isheapempty2', + style='boolean-block-style', + label=_('empty heap?'), + prim_name='isheapempty2', + value_block=True, + help_string=_('returns True if heap is empty')) + self.tw.lc.def_prim('isheapempty2', 0, + lambda self: primitive_dictionary['isheapempty2']()) + primitive_dictionary['print'] = self._prim_print palette.add_block('comment', style='basic-style-1arg', @@ -1106,6 +1117,13 @@ bullets')) else: return 0 + def _prim_is_heap_empty_bool(self): + """ is FILO empty? """ + if len(self.tw.lc.heap) == 0: + return True + else: + return False + def _prim_pop(self): """ Pop value off of FILO """ if len(self.tw.lc.heap) == 0: -- cgit v0.9.1