[ocrfeeder] Deselect box with Shift+Click when the box is selected
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Deselect box with Shift+Click when the box is selected
- Date: Wed, 24 Mar 2010 11:05:29 +0000 (UTC)
commit c8a51e6bf225310ccc4b33a55aab89afbcd6131f
Author: Joaquim Rocha <jrocha cookiemonster local igalia com>
Date: Wed Mar 24 10:43:24 2010 +0100
Deselect box with Shift+Click when the box is selected
studio/customWidgets.py | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/studio/customWidgets.py b/studio/customWidgets.py
index a295329..8118aba 100644
--- a/studio/customWidgets.py
+++ b/studio/customWidgets.py
@@ -139,11 +139,22 @@ class SelectableBoxesArea(goocanvas.Canvas):
if selected_area != None:
selected_area.set_property('stroke_color_rgba',
self.__rgbaToInteger(self.area_stroke_rgba))
+ # The deselectArea is not used in here for efficiency purposes
while self.selected_areas:
selected_area = self.selected_areas.pop(0)
self.emit('deselected_box', selected_area)
self.grab_focus(self.image)
-
+
+ def deselectArea(self, area):
+ if not area in self.selected_areas:
+ return False
+ if area != None:
+ area.set_property('stroke_color_rgba',
+ self.__rgbaToInteger(self.area_stroke_rgba))
+ self.selected_areas.remove(area)
+ self.emit('deselected_box', area)
+ return True
+
def zoom(self, zoom_value, add_zoom = True):
new_zoom = zoom_value
set_zoom = False
@@ -213,6 +224,7 @@ class SelectableBoxesArea(goocanvas.Canvas):
end_point = (area.props.x + area.props.width - offset, area.props.y + area.props.height - offset)
bounds = goocanvas.Bounds(*(start_point + end_point))
overlaped_items = self.get_items_in_area(bounds, True, True, True)
+ overlaped_items.remove(area)
return overlaped_items
def handleOverlapedAreas(self, overlaped_areas):
@@ -258,8 +270,13 @@ class SelectableBoxesArea(goocanvas.Canvas):
return True
def pressedWithinArea(self, item, target, event):
+ deselected = False
if event.state != gtk.gdk.SHIFT_MASK:
self.deselectAreas()
+ else:
+ deselected = self.deselectArea(item)
+ if deselected:
+ return True
self.selected_areas.append(item)
self.selectArea(item)
self.emit('selected_box', item)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]