[pitivi] timeline: Observe meta changes on TrackElements



commit 431eec283fd270432ed1a03658a6c408bfb6ae2d
Author: Piotrek BrzeziƄski <thewildtree outlook com>
Date:   Sat Aug 7 20:35:15 2021 +0200

    timeline: Observe meta changes on TrackElements

 pitivi/undo/timeline.py     | 6 ++++--
 tests/test_undo_timeline.py | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index 7d03e1670..fdade6d29 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -139,7 +139,7 @@ class TimelineElementObserver(Loggable):
         self.action_log.push(action)
 
 
-class TrackElementObserver(TimelineElementObserver):
+class TrackElementObserver(TimelineElementObserver, MetaContainerObserver):
     """Monitors the props of a track element.
 
     Reports UndoableActions.
@@ -150,6 +150,7 @@ class TrackElementObserver(TimelineElementObserver):
 
     def __init__(self, ges_track_element, action_log):
         TimelineElementObserver.__init__(self, ges_track_element, action_log)
+        MetaContainerObserver.__init__(self, ges_track_element, action_log)
         if isinstance(ges_track_element, GES.BaseEffect):
             property_names = ("active", "priority",)
         else:
@@ -157,6 +158,7 @@ class TrackElementObserver(TimelineElementObserver):
         self.gobject_observer = GObjectObserver(ges_track_element, property_names, action_log)
 
     def release(self):
+        MetaContainerObserver.release(self)
         TimelineElementObserver.release(self)
         self.gobject_observer.release()
 
@@ -738,7 +740,7 @@ class LayerObserver(MetaContainerObserver, Loggable):
                               self._control_binding_added_cb)
         track_element.connect("control-binding-removed",
                               self._control_binding_removed_cb)
-        if isinstance(track_element, (GES.BaseEffect, GES.VideoSource)):
+        if isinstance(track_element, (GES.BaseEffect, GES.VideoSource, GES.AudioSource)):
             observer = TrackElementObserver(track_element, self.action_log)
             self.track_element_observers[track_element] = observer
 
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 5afc9cc70..60012a854 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -342,7 +342,7 @@ class TestLayerObserver(common.TestCase):
             self.layer.add_clip(clip1)
 
         stack = self.action_log.undo_stacks[0]
-        self.assertEqual(len(stack.done_actions), 7, stack.done_actions)
+        self.assertEqual(len(stack.done_actions), 9, stack.done_actions)
         self.assertTrue(isinstance(stack.done_actions[0], ClipAdded))
         self.assertTrue(clip1 in self.get_timeline_clips())
 


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