diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-07-20 23:07:46 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-07-20 23:07:46 (GMT) |
commit | 863f605e77212665a761496431896aeb47b0ea5e (patch) | |
tree | 29f4e02fe1a2177c6e5c4b8c9ab0529f2de3f3c5 /plugins/turtle_blocks_extras | |
parent | 6ae104db18c310db137d62a8673c5f97cfdd5f1a (diff) |
share Turtle shell
Diffstat (limited to 'plugins/turtle_blocks_extras')
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index be44296..8442261 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import gtk +import gobject from time import time import os @@ -31,7 +32,7 @@ from TurtleArt.taconstants import DEFAULT_SCALE, ICON_SIZE, CONSTANTS, \ MEDIA_SHAPES, SKIN_PATHS, BLOCKS_WITH_SKIN, PYTHON_SKIN, \ PREFIX_DICTIONARY, VOICES from TurtleArt.tautils import convert, round_int, debug_output, get_path, \ - data_to_string, find_group + data_to_string, find_group, image_to_base64 from TurtleArt.tajail import myfunc, myfunc_import @@ -1193,6 +1194,24 @@ bullets')) if pen_state: self.tw.canvas.setpen(True) + if self.tw.sharing(): + if self.tw.running_sugar: + tmp_path = get_path(self.tw.activity, 'instance') + else: + tmp_path = '/tmp' + tmp_file = os.path.join(get_path(self.tw.activity, 'instance'), + 'tmpfile.png') + pixbuf.save(tmp_file, 'png', {'quality': '100'}) + data = image_to_base64(tmp_file, tmp_path) + height = pixbuf.get_height() + width = pixbuf.get_width() + event = 'R|%s' % (data_to_string([self.tw.nick, + [round_int(width), + round_int(height), + data]])) + gobject.idle_add(self.tw.send_event, event) + os.remove(tmp_file) + def _prim_save_picture(self, name): """ Save canvas to file as PNG """ self.tw.save_as_image(name) |