making it possible to select a ball by clicking on it
authorLincoln de Sousa <lincoln@minaslivre.org>
Tue, 12 Aug 2008 20:52:30 +0000 (17:52 -0300)
committerLincoln de Sousa <lincoln@minaslivre.org>
Tue, 12 Aug 2008 20:52:30 +0000 (17:52 -0300)
in the image (added method: Gzv.select_fp_from_image, changed: Gzv.button_press

gzv.py

diff --git a/gzv.py b/gzv.py
index 6d591fc..664b7f9 100644 (file)
--- a/gzv.py
+++ b/gzv.py
@@ -307,6 +307,17 @@ class Gzv(GladeLoader):
 
             self.draw.queue_draw()
 
+    def select_fp_from_image(self, ball):
+        selection = self.treeview.get_selection()
+        selection.select_path(str(ball.position))
+
+        # making sure that only one ball is selected
+        for i in self.balls:
+            i.selected = False
+        ball.selected = True
+
+        self.draw.queue_draw()
+
     def save_fp_list(self, *args):
         assert self.project is not None
 
@@ -391,6 +402,7 @@ class Gzv(GladeLoader):
                 if Point.pythagorean(p1, p2) < i.radius:
                     self.last_x = event.x - i.p.x
                     self.last_y = event.y - i.p.y
+                    self.select_fp_from_image(i)
 
                     self.new_ball = False
                     self.move_ball = i