[pitivi] ui.timelineedges: only allow one instance of the same time in the list of edges
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi] ui.timelineedges: only allow one instance of the same time in the list of edges
- Date: Fri, 10 Jul 2009 11:40:28 +0000 (UTC)
commit ad35c753eceb6adf293405952ca3787f44a9d230
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date: Tue Apr 21 12:28:40 2009 -0700
ui.timelineedges: only allow one instance of the same time in the list of edges
pitivi/timeline/timeline.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 40573dd..73c6f1e 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -686,12 +686,19 @@ class TimelineEdges(object):
@param end: A stop position to track.
@type end: L{long}
"""
+ # Only allow one instance of any particular edge. Since bisect right
+ # returns the index *after* any previous element in the list, we check
+ # to see whether the previous index already contains the item we are
+ # looking for.
index = bisect_right(self.edges, start)
- self.edges.insert(index, start)
+ if (len(self.edges) == 0) or (self.edges[index - 1] != start):
+ self.edges.insert(index, start)
if end is not None:
index = bisect_right(self.edges, end, index)
- self.edges.insert(index, end)
-
+ if (len(self.edges) == 0) or (self.edges[index - 1] != end):
+ self.edges.insert(index, end)
+ print self.edges, start, end
+
def removeStartEnd(self, start, end=None):
"""
Remove the given start/end values from the list of edges being tracked.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]