[pitivi] elements: Change keyframes scale for the volume property
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] elements: Change keyframes scale for the volume property
- Date: Mon, 21 Dec 2015 16:53:27 +0000 (UTC)
commit 99c073d1fd7df67d726572b3a779539b9e4720a5
Author: Thibault Saunier <tsaunier gnome org>
Date: Mon Dec 21 12:56:57 2015 +0100
elements: Change keyframes scale for the volume property
From [0 - 10] to [0 - 2] to make it simpler for users to deal
with the keyframes UI.
And blacklist the volume effect
Fixes T3076, T3479
Differential Revision: https://phabricator.freedesktop.org/D597
pitivi/effects.py | 2 +-
pitivi/timeline/elements.py | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 8c777bd..d312e8d 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -128,7 +128,7 @@ VIDEO_EFFECTS_CATEGORIES = (
BLACKLISTED_EFFECTS = ["colorconvert", "coglogoinsert", "festival",
"alphacolor", "cogcolorspace", "videodetect",
- "navigationtest", "videoanalyse"]
+ "navigationtest", "videoanalyse", "volume"]
# FIXME Check if this is still true with GES
# We should unblacklist it when #650985 is solved
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 16199ae..be35807 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -60,7 +60,23 @@ NORMAL_CURSOR = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
DRAG_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND1)
+def get_pspec(element_factory_name, propname):
+ element = Gst.ElementFactory.make(element_factory_name)
+ if not element:
+ return None
+
+ return [prop for prop in element.list_properties() if prop.name == propname][0]
+
+
class KeyframeCurve(FigureCanvas, Loggable):
+ YLIM_OVERRIDES = {}
+
+ __YLIM_OVERRIDES_VALUES = [("volume", "volume", (0.0, 0.2))]
+
+ for factory_name, propname, values in __YLIM_OVERRIDES_VALUES:
+ pspec = get_pspec(factory_name, propname)
+ if pspec:
+ YLIM_OVERRIDES[pspec] = values
__gsignals__ = {
# Signal our values changed, and a redraw will be needed
@@ -79,6 +95,7 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.__timeline = timeline
self.__source = binding.props.control_source
self.__propertyName = binding.props.name
+ self.__pspec = binding.pspec
self.__resetTooltip()
# Curve values, basically separating source.get_values() timestamps
@@ -144,7 +161,9 @@ class KeyframeCurve(FigureCanvas, Loggable):
self.__line_ys.append(value.value)
self.__ax.set_xlim(self.__line_xs[0], self.__line_xs[-1])
- self.__ax.set_ylim(0.0, 1.0)
+ ylim_min, ylim_max = KeyframeCurve.YLIM_OVERRIDES.get(
+ self.__pspec, (0.0, 1.0))
+ self.__ax.set_ylim(ylim_min, ylim_max)
arr = numpy.array((self.__line_xs, self.__line_ys))
arr = arr.transpose()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]