Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-11-01 12:51:52 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-11-01 12:51:52 (GMT)
commit9d8193b92c8f7395b4b17de657c067c4afcbd412 (patch)
tree2f6ec1ff81f019eb1c4a845743f427742e8cbfb0
parenta9bf160333d9306f479b01455dc01930b1fe7d35 (diff)
convert save_as_image blocks
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index 97d04fc..9bf4cbb 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -237,7 +237,6 @@ Journal'))
call_afterwards=lambda value: self.after_set(
'scale', value)))
- primitive_dictionary['savepix'] = self._prim_save_picture
palette.add_block('savepix',
style='basic-style-1arg',
label=_('save picture'),
@@ -246,9 +245,9 @@ Journal'))
help_string=_('saves a picture to the Sugar \
Journal'))
self.tw.lc.def_prim('savepix', 1,
- lambda self, x: primitive_dictionary['savepix'](x))
+ Primitive(self.tw.save_as_image,
+ arg_descs=[ArgSlot(TYPE_STRING)]))
- primitive_dictionary['savesvg'] = self._prim_save_svg
palette.add_block('savesvg',
style='basic-style-1arg',
label=_('save SVG'),
@@ -257,7 +256,9 @@ Journal'))
help_string=_('saves turtle graphics as an SVG file \
in the Sugar Journal'))
self.tw.lc.def_prim('savesvg', 1,
- lambda self, x: primitive_dictionary['savesvg'](x))
+ Primitive(self.tw.save_as_image,
+ arg_descs=[ArgSlot(TYPE_STRING)],
+ kwarg_descs={'svg': ConstantArg(True)}))
palette.add_block('scale',
style='box-style',
@@ -1149,14 +1150,6 @@ Journal objects'))
else:
self.tw.lc.update_label_value('pop', self.tw.lc.heap[-1])
- def _prim_save_picture(self, name):
- """ Save canvas to file as PNG """
- self.tw.save_as_image(name)
-
- def _prim_save_svg(self, name):
- """ Save SVG to file """
- self.tw.save_as_image(name, svg=True)
-
def prim_speak(self, text):
""" Speak text """
if type(text) == float and int(text) == text: