[pitivi] timeline/elements: add a way to remove keyframes.
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline/elements: add a way to remove keyframes.
- Date: Mon, 8 Jul 2013 00:51:46 +0000 (UTC)
commit 81c8484c83eb6d337dd23634a9e5f37155ad1a62
Author: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Date: Tue Jun 25 15:48:42 2013 +0200
timeline/elements: add a way to remove keyframes.
It's possible to remove keyframes now by holding CTRL and clicking a keyframe.
pitivi/timeline/elements.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 81c36af..1da3310 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -409,6 +409,11 @@ class TimelineElement(Clutter.Actor, Zoomable):
self.source.set(timestamp, value)
self.updateKeyframes()
+ def removeKeyframe(self, kf):
+ self.source.unset(kf.value.timestamp)
+ self.keyframes = sorted(self.keyframes, key=lambda keyframe: keyframe.value.timestamp)
+ self.updateKeyframes()
+
def showKeyframes(self, effect, propname):
binding = effect.get_control_binding(propname.name)
if not binding:
@@ -687,6 +692,9 @@ class Keyframe(Clutter.Actor):
self.connect("key-press-event", self._keyPressEventCb)
self.connect("enter-event", self._enterEventCb)
self.connect("leave-event", self._leaveEventCb)
+
+ self.connect("button-press-event", self._clickedCb)
+
self.set_reactive(True)
def _unselect(self):
@@ -694,6 +702,17 @@ class Keyframe(Clutter.Actor):
self.set_background_color(Clutter.Color.new(0, 255, 0, 255))
self.timelineElement.timeline._container.embed.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.ARROW))
+ def _remove(self):
+ # Can't remove edge keyframes !
+ if not self.has_changable_time:
+ return
+
+ self.timelineElement.removeKeyframe(self)
+
+ def _clickedCb(self, actor, event):
+ if (event.modifier_state & Clutter.ModifierType.CONTROL_MASK):
+ self._remove()
+
def _keyPressEventCb(self, actor, event):
print event, dir(event)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]