[pitivi] effects: Disallow to add 2 videoflip effects on a clip
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] effects: Disallow to add 2 videoflip effects on a clip
- Date: Tue, 9 Aug 2016 13:32:18 +0000 (UTC)
commit 7f05bdde5139bb0fc6d5f8b87601aab581c884b7
Author: Thibault Saunier <tsaunier gnome org>
Date: Wed Aug 3 15:14:18 2016 -0400
effects: Disallow to add 2 videoflip effects on a clip
Reviewed-by: Alex Băluț <alexandru balut gmail com>
Differential Revision: https://phabricator.freedesktop.org/D1243
pitivi/clipproperties.py | 12 ++++++++++++
pitivi/effects.py | 2 ++
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 84c76f1..d06ea43 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -27,6 +27,7 @@ from gi.repository import Gtk
from gi.repository import Pango
from pitivi.configure import get_ui_dir
+from pitivi.effects import ALLOWED_ONLY_ONCE_EFFECTS
from pitivi.effects import AUDIO_EFFECT
from pitivi.effects import EffectsPropertiesManager
from pitivi.effects import HIDDEN_EFFECTS
@@ -308,9 +309,19 @@ class EffectProperties(Gtk.Expander, Loggable):
def addEffectToClip(self, clip, factory_name, priority=None):
"""Adds the specified effect if it can be applied to the clip."""
+ if factory_name in ALLOWED_ONLY_ONCE_EFFECTS:
+ for effect in clip.find_track_elements(None, GES.TrackType.VIDEO,
+ GES.BaseEffect):
+ for elem in effect.get_nleobject().iterate_recurse():
+ if elem.get_factory().get_name() == factory_name:
+ self.error("Not adding %s as it would be duplicate"
+ " and this is not allowed.", factory_name)
+ # TODO Let the user know about why it did not work.
+ return effect
model = self.treeview.get_model()
media_type = self.app.effects.getInfo(factory_name).media_type
+
for track_element in clip.get_children(False):
track_type = track_element.get_track_type()
if track_type == GES.TrackType.AUDIO and media_type == AUDIO_EFFECT or \
@@ -325,6 +336,7 @@ class EffectProperties(Gtk.Expander, Loggable):
clip.set_top_effect_priority(effect, priority)
pipeline.commit_timeline()
break
+ return None
def addEffectToCurrentSelection(self, factory_name):
"""Adds an effect to the current selection.
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 964ffea..46bf5fa 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -53,6 +53,8 @@ from pitivi.utils.widgets import GstElementSettingsWidget
AUDIO_EFFECTS_CATEGORIES = ()
+ALLOWED_ONLY_ONCE_EFFECTS = ['videoflip']
+
VIDEO_EFFECTS_CATEGORIES = (
(_("Colors"), (
# Mostly "serious" stuff that relates to correction/adjustments
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]