diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-04-06 02:49:50 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-04-06 02:49:50 (GMT) |
commit | 39a9a7030a774257d7398661edec9f50f6135974 (patch) | |
tree | c95ca2be1e92b584bce66d5fc58763c79b0f61af /src/sugar/tutorius/actions.py | |
parent | 524e2de6d7369f26075e7af184f932ef876ea4f9 (diff) | |
parent | 3e92e7a3ab862901e473e5f3a05d08d9af185f68 (diff) |
Merge branch 'lp353185'
Conflicts:
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/actiontests.py
Diffstat (limited to 'src/sugar/tutorius/actions.py')
-rw-r--r-- | src/sugar/tutorius/actions.py | 15 |
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() |