Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-10-07 12:24:04 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-10-07 12:24:04 (GMT)
commit4e75964c7d73a2f763728c0858e0a6130cd456a5 (patch)
tree369d01670be935a0be82dae329b5527b53e0f7b1
parent83369c96ba7ff12baab5cb8aa1c491c8d46fccd9 (diff)
consolidation of remote turtle positioning code
-rw-r--r--TurtleArt/tacollaboration.py9
-rw-r--r--TurtleArtActivity.py4
-rw-r--r--gnome_plugins/collaboration_plugin.py4
3 files changed, 13 insertions, 4 deletions
diff --git a/TurtleArt/tacollaboration.py b/TurtleArt/tacollaboration.py
index e1534a4..8316c7a 100644
--- a/TurtleArt/tacollaboration.py
+++ b/TurtleArt/tacollaboration.py
@@ -232,7 +232,7 @@ class Collaboration():
self._get_colors()
event_payload = data_to_string(self._tw.remote_turtle_dictionary)
self.send_event('T|' + event_payload)
- self._send_my_xy() # And the sender should report her xy position.
+ self.send_my_xy() # And the sender should report her xy position.
def _receive_turtle_dict(self, payload):
''' Any time there is a new joiner, an updated turtle dictionary is
@@ -260,10 +260,11 @@ class Collaboration():
debug_output('%s already in remote turtle dictionary' \
% (nick), self._tw.running_sugar)
self.waiting_for_turtles = False
- self._send_my_xy()
+ self.send_my_xy()
- def _send_my_xy(self):
- ''' Set xy location so joiner can sync turtle positions. '''
+ def send_my_xy(self):
+ ''' Set xy location so joiner can sync turtle positions. Should be
+ used to sync positions after turtle drag. '''
self._tw.canvas.set_turtle(self._get_nick())
if self._tw.canvas.pendown:
self.send_event('p|%s' % (data_to_string([self._get_nick(),
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 3395b48..861122f 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -733,6 +733,10 @@ class TurtleArtActivity(activity.Activity):
self._collaboration = Collaboration(self.tw, self)
self._collaboration.setup()
+ def send_xy(self):
+ ''' Resync xy position (and orientation) of my turtle. '''
+ self._collaboration.send_my_xy()
+
def _setup_visibility_handler(self):
''' Notify me when the visibility state changes. '''
self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
diff --git a/gnome_plugins/collaboration_plugin.py b/gnome_plugins/collaboration_plugin.py
index 19c084b..4ba98a5 100644
--- a/gnome_plugins/collaboration_plugin.py
+++ b/gnome_plugins/collaboration_plugin.py
@@ -133,6 +133,10 @@ class Collaboration_plugin(Plugin):
return neighborhood_menu
+ def send_xy(self):
+ ''' Resync xy position (and orientation) of my turtle. '''
+ self._collaboration.send_my_xy()
+
def get_colors(self):
return self._colors