[pitivi] undo: Default implementation for asScenarioAction



commit 90cdd81a20b65c784a6dde5b08c7c5bb2d616b86
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Oct 24 00:44:26 2019 +0200

    undo: Default implementation for asScenarioAction

 pitivi/application.py  | 10 +++-------
 pitivi/undo/project.py |  1 +
 pitivi/undo/undo.py    |  3 ++-
 pre-commit.hook        |  1 -
 4 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 6f2e8507..496eb4f7 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -366,13 +366,9 @@ class Pitivi(Gtk.Application, Loggable):
         show_shortcuts(self)
 
     def _action_log_pre_push_cb(self, unused_action_log, action):
-        try:
-            st = action.asScenarioAction()
-        except NotImplementedError:
-            self.warning("No serialization method for action %s", action)
-            return
-        if st:
-            self.write_action(st)
+        scenario_action = action.asScenarioAction()
+        if scenario_action:
+            self.write_action(scenario_action)
 
     def _actionLogCommit(self, action_log, unused_stack):
         if action_log.is_in_transaction():
diff --git a/pitivi/undo/project.py b/pitivi/undo/project.py
index 8c45e19b..56fb652e 100644
--- a/pitivi/undo/project.py
+++ b/pitivi/undo/project.py
@@ -16,6 +16,7 @@
 # License along with this program; if not, write to the
 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 # Boston, MA 02110-1301, USA.
+"""Logic for undo/redo project actions."""
 from gi.repository import GES
 from gi.repository import GObject
 from gi.repository import Gst
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index b088e271..dacda0f3 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -43,7 +43,8 @@ class Action(GObject.Object, Loggable):
         Loggable.__init__(self)
 
     def asScenarioAction(self):
-        raise NotImplementedError()
+        """Converts the action to a Gst.Structure for a `.scenario` file."""
+        return None
 
 
 class UndoableAction(Action):
diff --git a/pre-commit.hook b/pre-commit.hook
index f5e98f5b..e7765d4a 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -31,7 +31,6 @@ pitivi/timeline/ruler.py
 pitivi/timeline/timeline.py
 pitivi/titleeditor.py
 pitivi/transitions.py
-pitivi/undo/project.py
 pitivi/undo/timeline.py
 pitivi/undo/undo.py
 pitivi/utils/extract.py


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