[pitivi] ui/sourcelist.py: make *UnderMouse*() work with iconview



commit 678a0a792428c08249309bd1ca5f8df0a1a924a3
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Wed Feb 3 14:30:25 2010 -0800

    ui/sourcelist.py: make *UnderMouse*() work with iconview

 pitivi/ui/sourcelist.py |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/ui/sourcelist.py b/pitivi/ui/sourcelist.py
index 303780d..669bc21 100644
--- a/pitivi/ui/sourcelist.py
+++ b/pitivi/ui/sourcelist.py
@@ -652,18 +652,25 @@ class SourceList(gtk.VBox, Loggable):
     _dragY = 0
     _ignoreRelease = False
 
-    def _rowUnderMouseSelected(self, treeview, event):
-        result = treeview.get_path_at_pos(int(event.x), int(event.y))
+    def _rowUnderMouseSelected(self, view, event):
+        result = view.get_path_at_pos(int(event.x), int(event.y))
         if result:
             path = result[0]
-            selection = treeview.get_selection()
+            if isinstance(view, gtk.TreeView):
+                selection = view.get_selection()
 
-            return selection.path_is_selected(path) and selection.count_selected_rows() > 1
+                return selection.path_is_selected(path) and selection.count_selected_rows() > 0
+            elif isinstance(view, gtk.IconView):
+                selection = view.get_selected_items()
+
+                return view.path_is_selected(path) and len(selection)
+            else:
+                assert False
 
         return False
 
-    def _nothingUnderMouse(self, treeview, event):
-        return not bool(treeview.get_path_at_pos(int(event.x), int(event.y)))
+    def _nothingUnderMouse(self, view, event):
+        return not bool(view.get_path_at_pos(int(event.x), int(event.y)))
 
     def _treeViewButtonPressEventCb(self, treeview, event):
         chain_up = True



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