Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugins/turtle_blocks_extras/turtle_blocks_extras.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/turtle_blocks_extras/turtle_blocks_extras.py')
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py47
1 files changed, 2 insertions, 45 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index c909803..22bae62 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -553,7 +553,6 @@ make "tmp first :taheap\nmake "taheap butfirst :taheap\noutput :tmp\nend\n')
arg_descs=[ConstantArg(
Primitive(self.tw.lc.get_heap, return_type=TYPE_BOOL))]))
- primitive_dictionary['print'] = self._prim_print
palette.add_block('comment',
style='basic-style-1arg',
label=_('comment'),
@@ -573,8 +572,8 @@ make "tmp first :taheap\nmake "taheap butfirst :taheap\noutput :tmp\nend\n')
help_string=_('prints value in status block at \
bottom of the screen'))
self.tw.lc.def_prim('print', 1,
- lambda self, x:
- primitive_dictionary['print'](x, False))
+ Primitive(self.tw.print_,
+ arg_descs=[ArgSlot(TYPE_OBJECT), ConstantArg(False)]))
palette.add_block('chr',
style='number-style-1arg',
@@ -1146,48 +1145,6 @@ Journal objects'))
else:
self.tw.lc.update_label_value('pop', self.tw.lc.heap[-1])
- def _prim_print(self, n, flag):
- """ Print object n """
- if flag and (self.tw.hide or self.tw.step_time == 0):
- return
- if isinstance(n, list):
- self.tw.showlabel('print', n)
- elif isinstance(n, Color):
- if n.color is None:
- self.tw.showlabel('print', '%s %d, %s %d' %
- (_('shade'), n.shade,
- _('gray'), n.gray))
- else:
- self.tw.showlabel('print', '%s %d, %s %d, %s %d' %
- (_('color'), n.color,
- _('shade'), n.shade,
- _('gray'), n.gray))
- elif isinstance(n, basestring):
- if n[0:6] == 'media_' and \
- n[6:].lower not in media_blocks_dictionary:
- try:
- if self.tw.running_sugar:
- from sugar.datastore import datastore
- try:
- dsobject = datastore.get(n[6:])
- except:
- debug_output("Couldn't open %s" % (n[6:]),
- self.tw.running_sugar)
- self.tw.showlabel('print', dsobject.metadata['title'])
- dsobject.destroy()
- else:
- self.tw.showlabel('print', n[6:])
- except IOError:
- self.tw.showlabel('print', n)
- else:
- self.tw.showlabel('print', n)
- elif isinstance(n, int):
- self.tw.showlabel('print', n)
- else:
- self.tw.showlabel(
- 'print',
- str(round_int(n)).replace('.', self.tw.decimal_point))
-
def _prim_printheap(self):
""" Display contents of heap """
heap_as_string = str(self.tw.lc.heap)