[pitivi] timeline.py: add removeFactory method which removes all instances of a given factory



commit bc5eea15a7c360a2e3566a7544e7d43eb6abaae1
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Sun Jul 12 21:54:44 2009 -0700

    timeline.py: add removeFactory method which removes all instances of a given factory

 pitivi/timeline/timeline.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 2aa5d71..e37c3fb 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1244,6 +1244,15 @@ class Timeline(Signallable, Loggable):
                 track = track_object.track
                 track.removeTrackObject(track_object)
 
+    def removeFactory(self, factory):
+        """Remove every instance factory in the timeline
+        @param factory: the factory to remove from the timeline
+        """
+        objs = [obj for obj in self.timeline_objects if obj.factory is
+            factory]
+        for obj in objs:
+            self.removeTimelineObject(obj, deep=True)
+
     # FIXME : shouldn't this be made more generic (i.e. not specific to source factories) ?
     # FIXME : Maybe it should be up to the ObjectFactory to create the TimelineObject since
     #    it would know the exact type of TimelineObject to create with what properties (essential



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