Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tacollaboration.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2011-02-06 15:16:04 (GMT)
committer Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>2011-02-06 15:36:17 (GMT)
commite059c631054d8e941ff27bd0c606e7b80d205bca (patch)
treebed870938254e733f0157b3efc555b308a5ed4b3 /TurtleArt/tacollaboration.py
parent5206ca8cd92a0160a19546dfd08c12a052aefa69 (diff)
adding sharing of pixbufs
Diffstat (limited to 'TurtleArt/tacollaboration.py')
-rw-r--r--TurtleArt/tacollaboration.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/TurtleArt/tacollaboration.py b/TurtleArt/tacollaboration.py
index 9081edc..0383e6b 100644
--- a/TurtleArt/tacollaboration.py
+++ b/TurtleArt/tacollaboration.py
@@ -23,6 +23,10 @@ from dbus.service import signal
from dbus.gobject_service import ExportedGObject
import logging
import telepathy
+
+import gtk
+import base64
+
from TurtleArt.tautils import data_to_string, data_from_string
try:
@@ -75,7 +79,8 @@ class Collaboration():
'g' : self._set_pen_gray_level,
's' : self._set_pen_shade,
'w' : self._set_pen_width,
- 'p' : self._set_pen_state
+ 'p' : self._set_pen_state,
+ 'P' : self._draw_pixbuf
}
def _shared_cb(self, activity):
@@ -218,6 +223,17 @@ class Collaboration():
self._tw.canvas.set_turtle(nick, colors)
self.waiting_for_turtles = False
+ def _draw_pixbuf(self, payload):
+ if len(payload) > 0:
+ [nick, [a, b, x, y, w, h, path, width, height, stride,
+ bits_per_sample, has_alpha, colorspace, data]] =\
+ data_from_string(payload)
+ if nick != self._tw.nick:
+ self._tw.canvas.draw_pixbuf(gtk.gdk.pixbuf_new_from_data(
+ base64.standard_b64decode(data), colorspace, has_alpha,
+ bits_per_sample, width, height, stride), a, b, x, y, w,
+ h, path, False)
+
def _move_forward(self, payload):
if len(payload) > 0:
[nick, x] = data_from_string(payload)