Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/actions.py
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-04-06 02:41:41 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-04-06 02:41:41 (GMT)
commit3e92e7a3ab862901e473e5f3a05d08d9af185f68 (patch)
treeb85dcde72fee5ba9f8144458cc7339895aa597de /src/sugar/tutorius/actions.py
parent7f030fd302c0be7ca7dc38863e1d9250df00ca31 (diff)
Create chain action
Diffstat (limited to 'src/sugar/tutorius/actions.py')
-rw-r--r--src/sugar/tutorius/actions.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sugar/tutorius/actions.py b/src/sugar/tutorius/actions.py
index 60ccd8b..7681dea 100644
--- a/src/sugar/tutorius/actions.py
+++ b/src/sugar/tutorius/actions.py
@@ -213,4 +213,19 @@ class WidgetIdentifyAction(Action):
if self._dialog:
self._dialog.destroy()
+class ChainAction(Action):
+ """Utility class to allow executing actions in a specific order"""
+ def __init__(self, *actions):
+ """ChainAction(action1, ... ) builds a chain of actions"""
+ self._actions = actions
+
+ def do(self,**kwargs):
+ """do() each action in the chain"""
+ for act in self._actions:
+ act.do(**kwargs)
+
+ def undo(self):
+ """undo() each action in the chain, starting with the last"""
+ for act in reversed(self._actions):
+ act.undo()