Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/tacanvas.py2
-rw-r--r--TurtleArt/tacollaboration.py21
-rw-r--r--TurtleArt/tautils.py4
3 files changed, 10 insertions, 17 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py
index 0c5f454..1e54ea9 100644
--- a/TurtleArt/tacanvas.py
+++ b/TurtleArt/tacanvas.py
@@ -521,7 +521,6 @@ class TurtleGraphics:
else:
tmp_path = '/tmp'
data = image_to_base64(pixbuf, tmp_path)
- print "sharing pixbuf from %s" % (tmp_path)
height = pixbuf.get_height()
width = pixbuf.get_width()
event = "P|%s" % (data_to_string([self._get_my_nick(),
@@ -702,5 +701,4 @@ class TurtleGraphics:
return
if self.tw.sharing():
- # print "Sending: %s" % entry
self.tw.send_event(entry)
diff --git a/TurtleArt/tacollaboration.py b/TurtleArt/tacollaboration.py
index 48574da..ae56b1e 100644
--- a/TurtleArt/tacollaboration.py
+++ b/TurtleArt/tacollaboration.py
@@ -27,7 +27,7 @@ import telepathy
import gtk
import base64
-from TurtleArt.tautils import data_to_string, data_from_string
+from TurtleArt.tautils import data_to_string, data_from_string, base64_to_image
try:
from sugar import profile
@@ -81,7 +81,8 @@ class Collaboration():
'w' : self._set_pen_width,
'p' : self._set_pen_state,
'F' : self._fill_polygon,
- 'P' : self._draw_pixbuf
+ 'P' : self._draw_pixbuf,
+ 'z' : self._clear
}
def _shared_cb(self, activity):
@@ -185,14 +186,11 @@ class Collaboration():
# Save active Turtle
save_active_turtle = self._tw.active_turtle
- print "event_message", event_message
try:
command, payload = event_message.split("|", 2)
- print "event message %s" % command
- _logger.debug("event message (%s)" % command)
self._processing_methods[command](payload)
except ValueError:
- print "could not split event message"
+ _logger.debug("could not split event message")
# Restore active Turtle
self._tw.canvas.set_turtle(self._tw.turtles.get_turtle_key(
@@ -229,21 +227,20 @@ class Collaboration():
# add new turtle for the joiner
self._tw.canvas.set_turtle(nick, colors)
self.waiting_for_turtles = False
+
+ def _clear(self):
+ pass
def _draw_pixbuf(self, payload):
if len(payload) > 0:
- print "trying to draw a shared pixbuf"
- _logger.debug("(trying to draw a shared pixbuf)")
[nick, [a, b, x, y, w, h, width, height, data]] =\
data_from_string(payload)
if nick != self._tw.nick:
- if self.tw.running_sugar:
- tmp_path = get_path(self.tw.activity, 'instance')
+ if self._tw.running_sugar:
+ tmp_path = get_path(self._tw.activity, 'instance')
else:
tmp_path = '/tmp'
- print "creating %s" % (tmp_path)
file_name = base64_to_image(data, tmp_path)
- print "opening %s" % (file_path)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(file_name,
width, height)
self._tw.canvas.draw_pixbuf(pixbuf, a, b, x, y, w, h,
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 2b7b230..0486311 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -296,20 +296,18 @@ def image_to_base64(pixbuf, path_name):
file_handle = open(base64, 'r')
data = file_handle.read()
file_handle.close()
- print 'image to base64:' + file_name
return data
def base64_to_image(data, path_name):
""" Convert base64-encoded data to an image """
base64 = os.path.join(path_name, 'base64tmp')
- file_handle = open(_base64, 'w')
+ file_handle = open(base64, 'w')
file_handle.write(data)
file_handle.close()
file_name = os.path.join(path_name, 'imagetmp.png')
cmd = "base64 -d <" + base64 + ">" + file_name
subprocess.check_call(cmd, shell=True)
- print 'base64 to image:' + file_name
return file_name