[pitivi] Disable Keyframing for not interpolatable properties



commit 5dda844638abfe3a478c9f512c4fe81ccf245adf
Author: Thibault Saunier <tsaunier gnome org>
Date:   Tue Feb 2 20:28:42 2016 +0100

    Disable Keyframing for not interpolatable properties
    
    And simply let GstControlBinding tell us whether the property is
    usable or not.
    
    Differential Revision: https://phabricator.freedesktop.org/D733

 pitivi/utils/widgets.py |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index 01600bb..eea5063 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -33,6 +33,7 @@ import re
 from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import Gst
+from gi.repository import GstController
 from gi.repository import GES
 from gi.repository import Pango
 from gi.repository import GObject
@@ -707,13 +708,20 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
                 grid.attach(label, 0, y, 1, 1)
                 grid.attach(widget, 1, y, 1, 1)
 
-            controllable = self.isControllable and not isinstance(widget, DefaultWidget)
-            if (controllable and
-                    not isinstance(widget, ToggleWidget) and
-                    not isinstance(widget, ChoiceWidget)):
-                keyframe_toggle_button = self._createKeyframeToggleButton(prop)
-                self.keyframeToggleButtons[keyframe_toggle_button] = widget
-                grid.attach(keyframe_toggle_button, 2, y, 1, 1)
+            controllable = self.isControllable and \
+                not isinstance(widget, DefaultWidget)
+            if controllable and not isinstance(widget, (ToggleWidget,
+                                                        ChoiceWidget)):
+                res, element, pspec = self.element.lookup_child(prop.name)
+                assert(res)
+                binding = GstController.DirectControlBinding.new(
+                    element, prop.name,
+                    GstController.InterpolationControlSource())
+
+                if binding.pspec:
+                    keyframe_toggle_button = self._createKeyframeToggleButton(prop)
+                    self.keyframeToggleButtons[keyframe_toggle_button] = widget
+                    grid.attach(keyframe_toggle_button, 2, y, 1, 1)
 
             if hasattr(prop, 'blurb'):
                 widget.set_tooltip_text(prop.blurb)


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