[pitivi/1.0] clipproperties: Effects priority monitoring
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/1.0] clipproperties: Effects priority monitoring
- Date: Wed, 29 Aug 2018 13:40:43 +0000 (UTC)
commit fa2db6cf768303962c8d367112805ebbedf17466
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Aug 26 23:13:08 2018 +0200
clipproperties: Effects priority monitoring
Update the UI after setting the effect priority and after undo/redo of
effects reordering.
Fixes #2178
Fixes #2234
pitivi/clipproperties.py | 7 +++++--
pitivi/undo/timeline.py | 6 +++++-
tests/test_undo_timeline.py | 33 +++++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 4d0af92d..5887d648 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -302,13 +302,18 @@ class EffectProperties(Gtk.Expander, Loggable):
def _connect_to_track_element(self, track_element):
track_element.connect("notify::active", self._notify_active_cb)
+ track_element.connect("notify::priority", self._notify_priority_cb)
def _disconnect_from_track_element(self, track_element):
track_element.disconnect_by_func(self._notify_active_cb)
+ track_element.disconnect_by_func(self._notify_priority_cb)
def _notify_active_cb(self, unused_track_element, unused_param_spec):
self._updateTreeview()
+ def _notify_priority_cb(self, unused_track_element, unused_param_spec):
+ self._updateTreeview()
+
def _trackElementRemovedCb(self, unused_clip, track_element):
if isinstance(track_element, GES.BaseEffect):
self._disconnect_from_track_element(track_element)
@@ -338,7 +343,6 @@ class EffectProperties(Gtk.Expander, Loggable):
self.__remove_configuration_widget()
self.effects_properties_manager.cleanCache(effect)
effect.get_parent().remove(effect)
- self._updateTreeview()
def _drag_motion_cb(self, unused_widget, unused_drag_context, unused_x, unused_y, unused_timestamp):
"""Highlights some widgets to indicate it can receive drag&drop."""
@@ -416,7 +420,6 @@ class EffectProperties(Gtk.Expander, Loggable):
else:
# This should happen when dragging after the last row.
drop_index = len(model) - 1
- drop_pos = Gtk.TreeViewDropPosition.INTO_OR_BEFORE
return source_index, drop_index
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index b21ded42..390ddcde 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -146,7 +146,11 @@ class TrackElementObserver(TimelineElementObserver):
def __init__(self, ges_track_element, action_log):
TimelineElementObserver.__init__(self, ges_track_element, action_log)
- self.gobject_observer = GObjectObserver(ges_track_element, ("active",), action_log)
+ if isinstance(ges_track_element, GES.BaseEffect):
+ property_names = ("active", "priority",)
+ else:
+ property_names = ("active",)
+ self.gobject_observer = GObjectObserver(ges_track_element, property_names, action_log)
def release(self):
TimelineElementObserver.release(self)
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 4995fd60..3e9733cd 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -733,6 +733,39 @@ class TestControlSourceObserver(BaseTestUndoTimeline):
self.assertEqual(0.9, control_source.get_all()[0].value)
+class TestTrackElementObserver(BaseTestUndoTimeline):
+
+ def test_effects_index(self):
+ stacks = []
+ self.action_log.connect("commit", BaseTestUndoTimeline.commit_cb, stacks)
+
+ clip1 = GES.TitleClip()
+ self.layer.add_clip(clip1)
+
+ effect1 = GES.Effect.new("agingtv")
+ effect2 = GES.Effect.new("edgetv")
+ clip1.add(effect1)
+ clip1.add(effect2)
+ self.assertEqual(clip1.get_top_effect_index(effect1), 0)
+ self.assertEqual(clip1.get_top_effect_index(effect2), 1)
+
+ with self.action_log.started("move effect"):
+ assert clip1.set_top_effect_index(effect2, 0)
+
+ self.assertEqual(len(stacks), 1)
+
+ self.assertEqual(clip1.get_top_effect_index(effect1), 1)
+ self.assertEqual(clip1.get_top_effect_index(effect2), 0)
+
+ self.action_log.undo()
+ self.assertEqual(clip1.get_top_effect_index(effect1), 0)
+ self.assertEqual(clip1.get_top_effect_index(effect2), 1)
+
+ self.action_log.redo()
+ self.assertEqual(clip1.get_top_effect_index(effect1), 1)
+ self.assertEqual(clip1.get_top_effect_index(effect2), 0)
+
+
class TestTimelineElementObserver(BaseTestUndoTimeline):
def testTrackElementPropertyChanged(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]