[pitivi] undo: Report the current transaction when raising
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] undo: Report the current transaction when raising
- Date: Sat, 16 Apr 2016 14:25:22 +0000 (UTC)
commit c8bbfcdb496f1d16889cee869025ed44ff5ae1ff
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sat Apr 9 23:55:40 2016 +0200
undo: Report the current transaction when raising
Differential Revision: https://phabricator.freedesktop.org/D901
pitivi/undo/undo.py | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index dd6eb84..cf38e2c 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -30,12 +30,16 @@ from pitivi.utils.loggable import Loggable
class UndoError(Exception):
- """ Any exception related to the undo/redo feature."""
+ """
+ Base class for undo/redo exceptions.
+ """
pass
class UndoWrongStateError(UndoError):
- """ Exception related to the current state of the undo/redo stack. """
+ """
+ Exception related to the current state of the undo/redo stack.
+ """
pass
@@ -92,6 +96,9 @@ class UndoableActionStack(UndoableAction):
self.undone_actions = []
self.finalizing_action = finalizing_action
+ def __repr__(self):
+ return "%s: %s" % (self.action_group_name, self.done_actions)
+
def push(self, action):
self.done_actions.append(action)
@@ -238,7 +245,7 @@ class UndoableActionLog(GObject.Object, Loggable):
Undo the last recorded operation.
"""
if self.stacks:
- raise UndoWrongStateError("Recording a transaction")
+ raise UndoWrongStateError("Recording a transaction", self.stacks)
if not self.undo_stacks:
raise UndoWrongStateError("Nothing to undo")
@@ -252,7 +259,7 @@ class UndoableActionLog(GObject.Object, Loggable):
Redo the last undone operation.
"""
if self.stacks:
- raise UndoWrongStateError("Recording a transaction")
+ raise UndoWrongStateError("Recording a transaction", self.stacks)
if not self.redo_stacks:
raise UndoWrongStateError("Nothing to redo")
@@ -266,7 +273,7 @@ class UndoableActionLog(GObject.Object, Loggable):
def checkpoint(self):
if self.stacks:
- raise UndoWrongStateError("Recording a transaction")
+ raise UndoWrongStateError("Recording a transaction", self.stacks)
self._checkpoint = self._takeSnapshot()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]