[pitivi] Show the names of the actions that can be undone/redone.



commit 02868d4ebda31b57072ed625d03c44f9a775d7b3
Author: Alessandro Decina <alessandro d gmail com>
Date:   Wed Jun 10 13:54:14 2009 +0200

    Show the names of the actions that can be undone/redone.

 pitivi/ui/mainwindow.py |   17 +++++++++++------
 pitivi/undo.py          |   10 +++++-----
 2 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 152ab03..5d621ef 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -735,12 +735,17 @@ class PitiviMainWindow(gtk.Window, Loggable):
 
         dialog.destroy()
 
-    def _actionLogCanUndo(self, action_log, can_undo):
-        self.actiongroup.get_action("Undo").set_sensitive(can_undo)
-
-    def _actionLogCanRedo(self, action_log, can_redo):
-        self.actiongroup.get_action("Redo").set_sensitive(can_redo)
-
+    def _actionLogCanUndo(self, action_log, can_undo, action_group_name):
+        action = self.actiongroup.get_action("Undo")
+        action.set_sensitive(can_undo)
+        if can_undo:
+            action.props.label = _("Undo %s") % action_group_name
+
+    def _actionLogCanRedo(self, action_log, can_redo, action_group_name):
+        action = self.actiongroup.get_action("Redo")
+        action.set_sensitive(can_redo)
+        if can_redo:
+            action.props.label = _("Redo %s") % action_group_name
 
 ## PiTiVi current project callbacks
 
diff --git a/pitivi/undo.py b/pitivi/undo.py
index 6509eb5..f258602 100644
--- a/pitivi/undo.py
+++ b/pitivi/undo.py
@@ -189,7 +189,7 @@ class UndoableActionLog(Signallable):
         nested = self._stackIsNested(stack)
         if not self.stacks:
             self.undo_stacks.append(stack)
-            self.emit("can-undo", True)
+            self.emit("can-undo", True, stack.action_group_name)
         else:
             self.stacks[-1].push(stack)
 
@@ -202,13 +202,13 @@ class UndoableActionLog(Signallable):
 
         stack = self.undo_stacks.pop(-1)
         if not self.undo_stacks:
-            self.emit("can-undo", False)
+            self.emit("can-undo", False, None)
 
         self._runStack(stack, stack.undo)
 
         self.redo_stacks.append(stack)
         self.emit("undo", stack)
-        self.emit("can-redo", True)
+        self.emit("can-redo", True, stack.action_group_name)
 
     def redo(self):
         if self.stacks or not self.redo_stacks:
@@ -216,12 +216,12 @@ class UndoableActionLog(Signallable):
 
         stack = self.redo_stacks.pop(-1)
         if not self.redo_stacks:
-            self.emit("can-redo", False)
+            self.emit("can-redo", False, None)
 
         self._runStack(stack, stack.do)
         self.undo_stacks.append(stack)
         self.emit("redo", stack)
-        self.emit("can-undo", True)
+        self.emit("can-undo", True, stack.action_group_name)
 
     def _runStack(self, stack, run):
         self._connectToRunningStack(stack)



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