[pitivi] medialibrary: Make rectangle selection work



commit f2ed81475bc20b291c8563ab3c79a04a7f5d448a
Author: Luis de Bethencourt <luis debethencourt com>
Date:   Wed Mar 13 11:28:48 2013 -0400

    medialibrary: Make rectangle selection work

 pitivi/medialibrary.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 826efc9..57e094b 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -234,6 +234,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         self.iconview.set_tooltip_column(COL_INFOTEXT)
         self.iconview.props.item_padding = 3
         self.iconview.props.margin = 3
+        self.iconview_on_path = None
 
         cell = Gtk.CellRendererPixbuf()
         self.iconview.pack_start(cell, False)
@@ -908,17 +909,18 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
                 self.iconview.select_path(path)
 
         self._ignoreRelease = chain_up
+        self.iconview_on_path = self.iconview.get_path_at_pos(event.x, event.y)
 
         return True
 
     def _iconViewButtonReleaseEventCb(self, iconview, event):
-        state = event.get_state() & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)
-        path = self.iconview.get_path_at_pos(event.x, event.y)
+        if self.iconview_on_path:
+            path = self.iconview.get_path_at_pos(event.x, event.y)
 
-        if not state and not self.dragged:
-            iconview.unselect_all()
-            if path:
-                iconview.select_path(path)
+            if path == self.iconview_on_path:
+                if iconview.path_is_selected(path):
+                    iconview.unselect_all()
+                    iconview.select_path(path)
 
     def _newProjectCreatedCb(self, app, project):
         if not self._project is project:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]