diff options
author | Walter Bender <walter@sugarlabs.org> | 2013-05-16 18:55:36 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2013-05-16 18:55:36 (GMT) |
commit | 372547cbb63fd2416ee434be1cfaacc051c35344 (patch) | |
tree | c779d57e7088e94d4e92c5c0e3dda89326ee16cf /plugins/turtle_blocks_extras | |
parent | cfcd23ffed0000bcb1896e6fd1b4e5778477893d (diff) |
add active turtle block
Diffstat (limited to 'plugins/turtle_blocks_extras')
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index 6201fae..6b0f3ce 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -696,6 +696,17 @@ module found in the Journal')) self.tw.lc.def_prim('turtle', 1, lambda self, x: self.tw.canvas.set_turtle(x)) + primitive_dictionary['activeturtle'] = self._prim_active_turtle + palette.add_block('activeturtle', + style='box-style', + #TRANS: pop removes a new item from the program stack + label=_('active turtle'), + prim_name='activeturtle', + value_block=True, + help_string=_('the name of the active turtle')) + self.tw.lc.def_prim('activeturtle', 0, + lambda self: primitive_dictionary['activeturtle']()) + primitive_dictionary['skin'] = self._prim_reskin palette.add_block('skin', hidden=True, @@ -1231,6 +1242,9 @@ _('Palette of user-defined operators')) self.tw.lc.heap.append(g) self.tw.lc.heap.append(r) + def _prim_active_turtle(self): + return(self.tw.active_turtle.name) + def _prim_reskin(self, media): """ Reskin the turtle with an image from a file """ scale = int(ICON_SIZE * float(self.tw.lc.scale) / DEFAULT_SCALE) |