From 715cd1b218caf92fc360ec9b75da60f81b881138 Mon Sep 17 00:00:00 2001 From: Lincoln de Sousa Date: Tue, 12 Aug 2008 17:52:30 -0300 Subject: [PATCH] making it possible to select a ball by clicking on it in the image (added method: Gzv.select_fp_from_image, changed: Gzv.button_press --- gzv.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gzv.py b/gzv.py index 6d591fc..664b7f9 100644 --- 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 -- 2.20.1