[pitivi] timeline.track: fix max priority calculation



commit 7b033e68dd97d7af37db446c3472afc31821e9d8
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Sun Mar 15 02:15:39 2009 -0700

    timeline.track: fix max priority calculation
---
 pitivi/timeline/track.py |   11 ++++++-----
 pitivi/ui/trackobject.py |    3 ++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 2c27272..405164e 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -379,16 +379,17 @@ class Track(object, Signallable):
 
     expanded = property(getExpanded, setExpanded)
 
-    __max_priority = 0
+    _max_priority = 0
 
     @property
     def max_priority(self):
-        return self.__max_priority
+        return self._max_priority
 
     def _trackObjectPriorityCb(self, trackobject, priority):
-        op = self.__max_priority
-        self.__max_priority = max(self.__max_priority, priority)
-        if op != self.__max_priority:
+        op = self._max_priority
+        self._max_priority = max((obj.priority for obj in self.track_objects
+            if obj is not self.default_track_object))
+        if op != self._max_priority:
             self.emit("max-priority-changed")
 
     def _connectToTrackObjectSignals(self, track_object):
diff --git a/pitivi/ui/trackobject.py b/pitivi/ui/trackobject.py
index ba5368b..7f530ac 100644
--- a/pitivi/ui/trackobject.py
+++ b/pitivi/ui/trackobject.py
@@ -121,7 +121,8 @@ class TrackObject(View, goocanvas.Group, Zoomable):
             x, y = pos
             self._view.element.setStart(max(self._view.pixelToNs(x), 0),
                     snap=True)
-            priority = int(max(0, y // (LAYER_HEIGHT_EXPANDED + LAYER_SPACING)))
+            priority = int(max(0, 1 + (y // (LAYER_HEIGHT_EXPANDED +
+                LAYER_SPACING))))
             self._view.element.priority = priority
 
     def __init__(self, element, track, timeline):



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