[pitivi/ges] utils/timeline: emit signals when trimming clips



commit 7716ce45a3628475c0080ee274e0720af26e8941
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Mon Mar 5 16:37:57 2012 -0500

    utils/timeline: emit signals when trimming clips

 pitivi/utils/timeline.py |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 5ef193d..a637f33 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -782,7 +782,12 @@ class MoveContext(EditingContext, Loggable):
         return position, priority
 
 
-class TrimStartContext(EditingContext):
+class TrimStartContext(EditingContext, Signallable):
+
+    __signals__ = {
+        "clip-trim": ["uri", "position"],
+        "clip-trim-finished": [],
+    }
 
     def __init__(self, timeline, focus, other):
         EditingContext.__init__(self, timeline, focus, other)
@@ -843,6 +848,7 @@ class TrimStartContext(EditingContext):
         self.focus.props.start = position
         self.focus.props.duration = self.focus.props.max_duration - \
                 self.focus.props.in_point
+        self.emit("clip-trim", self.focus.props.uri, self.focus.props.in_point)
         return position, priority
 
     def finish(self):
@@ -864,8 +870,16 @@ class TrimStartContext(EditingContext):
             position = initial_position - left_gap.duration
             self._defaultTo(position, obj)
 
+        self.emit("clip-trim-finished")
+
+
+class TrimEndContext(EditingContext, Signallable):
+
+    __signals__ = {
+        "clip-trim": ["uri", "position"],
+        "clip-trim-finished": [],
+    }
 
-class TrimEndContext(EditingContext):
     def __init__(self, timeline, focus, other):
         EditingContext.__init__(self, timeline, focus, other)
         self.tracks = set([])
@@ -924,7 +938,7 @@ class TrimEndContext(EditingContext):
         duration = max(0, position - self.focus.props.start)
         duration = min(duration, self.focus.max_duration)
         self.focus.props.duration = duration
-
+        self.emit("clip-trim", self.focus.props.uri, self.focus.props.duration)
         return position, priority
 
     def finish(self):
@@ -949,6 +963,8 @@ class TrimEndContext(EditingContext):
             duration = absolute_initial_duration + right_gap.duration
             self._defaultTo(duration, obj.props.priority)
 
+        self.emit("clip-trim-finished")
+
 
 #-------------------------- Interfaces ----------------------------------------#
 



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