[pitivi] Don't let separators highlighted after drag'n'drop



commit 94c8bd41b2b6cbf29f2e20227bc22caf51417970
Author: Paul Lange <palango gmx de>
Date:   Sun Jul 15 20:23:15 2012 +0200

    Don't let separators highlighted after drag'n'drop

 pitivi/timeline/timeline.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index bccae4b..773feaf 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -514,6 +514,7 @@ class TimelineControls(gtk.VBox, Loggable):
         # drag'n' drop
         self.connect("drag_data_received", self._dragDataReceivedCb)
         self.connect("drag_motion", self._dragMotionCb)
+        self.connect("drag_leave", self._dragLeaveCb)
         self.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
                              gtk.DEST_DEFAULT_DROP,
                              [LAYER_CONTROL_TUPLE], gtk.gdk.ACTION_MOVE)
@@ -751,19 +752,20 @@ class TimelineControls(gtk.VBox, Loggable):
         widget = self.getControlFromId(int(selection.data))
         widget_type = type(widget)
 
-        for child in self.get_children():
-            child.setSeparatorHighlight(False)
+        self._unhighlightSeparators()
 
         self.moveControlWidget(widget, self._getIndexForPosition(y, widget))
 
+    def _dragLeaveCb(self, widget, context, timestamp):
+        self._unhighlightSeparators()
+
     def _dragMotionCb(self, widget, context, x, y, timestamp):
         """
         Highlight separator where control would go when dropping
         """
         index = self._getIndexForPosition(y, context.get_source_widget())
 
-        for child in self.get_children():
-            child.setSeparatorHighlight(False)
+        self._unhighlightSeparators()
 
         # control would go in first position
         if index == 0:
@@ -771,6 +773,10 @@ class TimelineControls(gtk.VBox, Loggable):
         else:
             self.get_children()[index - 1].setSeparatorHighlight(True)
 
+    def _unhighlightSeparators(self):
+        for child in self.get_children():
+            child.setSeparatorHighlight(False)
+
     def _getIndexForPosition(self, y, widget):
         """
         Calculates the new index for a dragged layer



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