[pitivi] Serialize GES.Clip.split actions



commit e7fc2830661bb3759c30dd274f6a82d9833343a5
Author: Thibault Saunier <tsaunier gnome org>
Date:   Thu Sep 25 15:57:05 2014 +0200

    Serialize GES.Clip.split actions
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739251

 pitivi/project.py           |    2 +-
 pitivi/timeline/timeline.py |    8 ++++++++
 pitivi/undo/timeline.py     |    4 ++++
 pitivi/undo/undo.py         |    2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 24da94a..f84d41d 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -97,7 +97,7 @@ class AssetAddedAction(UndoableAction):
 
     def serializeLastAction(self):
         st = Gst.Structure.new_empty("add-asset")
-        st.set_value("id", self.asset.get_info().get_uri())
+        st.set_value("id", self.asset.get_id())
         type_string = GObject.type_name(self.asset.get_extractable_type())
         st.set_value("type", type_string)
         return st
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 67a1410..472b1d0 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1262,7 +1262,15 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
             end = start + element.get_duration()
             if start < position and end > position:
                 clip = element.get_parent()
+                clip.get_layer().splitting_object = True
+
+                st = Gst.Structure.new_empty("split-clip")
+                st["clip-name"] = clip.get_name()
+                st["position"] = float(position / Gst.SECOND)
+                self.app.write_action(st)
+
                 clip.split(position)
+                clip.get_layer().splitting_object = False
 
     def _keyframeCb(self, unused_action):
         """
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index d1af68f..2bbcd03 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -135,6 +135,10 @@ class ClipAdded(UndoableAction):
         self._undone()
 
     def serializeLastAction(self):
+        if hasattr(self.layer, "splitting_object") and \
+                self.layer.splitting_object is True:
+            return None
+
         st = Gst.Structure.new_empty("add-clip")
         st.set_value("name", self.clip.get_name())
         st.set_value("layer-priority", self.layer.props.priority)
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index 0f933b7..1dd8c22 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -166,7 +166,7 @@ class UndoableActionLog(GObject.Object, Loggable):
 
         try:
             st = action.serializeLastAction()
-            if self.app is not None:
+            if self.app is not None and st is not None:
                 self.app.write_action(st)
         except NotImplementedError:
             self.warning("No serialization method for that action")


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