[pitivi] Fix priority calculation for small numbers of layers



commit 78fee7388703dadad3d018ec1e54133962f65767
Author: Paul Lange <palango gmx de>
Date:   Wed Jun 27 17:05:14 2012 +0200

    Fix priority calculation for small numbers of layers

 pitivi/timeline/timeline.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 5c76588..c82926c 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -581,6 +581,8 @@ class TimelineControls(gtk.VBox, Loggable):
     def getPriorityForY(self, y):
         priority = -1
         current = 0
+
+        # increment priority for each layer we pass
         for child in self.get_children():
             if y <= current:
                 return priority
@@ -588,6 +590,11 @@ class TimelineControls(gtk.VBox, Loggable):
             current += child.getHeight() + LAYER_SPACING
             priority += 1
 
+        # another check if priority has been incremented but not returned
+        # because there were no more children
+        if y <= current:
+            return priority
+
         return 0
 
 



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