Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2011-02-02 16:20:56 (GMT)
committer Walter Bender <walter@sugarlabs.org>2011-02-02 16:20:56 (GMT)
commit40d99b845c3d95c52d12300f67ed52defe22dd9b (patch)
tree2d7e53723c0850b069d939c6e21247808d1703e6
parent725ac099fbdb5434c56110c2b8d9a1da4bbbb5b6 (diff)
adding send_event to draw_text
-rw-r--r--TurtleArt/tacanvas.py6
-rw-r--r--TurtleArt/tacollaboration.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py
index d4395a2..52b692a 100644
--- a/TurtleArt/tacanvas.py
+++ b/TurtleArt/tacanvas.py
@@ -497,7 +497,7 @@ class TurtleGraphics:
self.tw.svg_string += self.svg.image(x - self.width / 2,
y, w, h, path)
- def draw_text(self, label, x, y, size, w):
+ def draw_text(self, label, x, y, size, w, share=True):
""" Draw text """
w *= self.tw.coord_scale
self.gc.set_foreground(self.tw.textcolor)
@@ -532,6 +532,10 @@ class TurtleGraphics:
if self.tw.saving_svg and self.pendown:
self.tw.svg_string += self.svg.text(x - self.width / 2,
y + size, size, w, label)
+ event = "W|%s" % (data_to_string([self._get_my_nick(),
+ [label, round_int(x), round_int(y),
+ round_int(size), round_int(w)]]))
+ self._send_event(event, share)
def draw_line(self, x1, y1, x2, y2):
""" Draw a line """
diff --git a/TurtleArt/tacollaboration.py b/TurtleArt/tacollaboration.py
index 52164e0..b24bec4 100644
--- a/TurtleArt/tacollaboration.py
+++ b/TurtleArt/tacollaboration.py
@@ -190,6 +190,11 @@ class Collaboration():
if nick != self._tw.nick:
self._tw.canvas.set_turtle(nick)
self._tw.canvas.setxy(x, y, False)
+ elif e[0] == 'W': # draw text
+ if len(text) > 0:
+ [nick, [label, x, y, size, w]] = data_from_string(text)
+ if nick != self._tw.nick:
+ self._tw.canvas.draw_text(label, x, y, size, w, False)
elif e[0] == 'c': # set turtle pen color
if len(text) > 0:
[nick, x] = data_from_string(text)