summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-08-28 21:14:45 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-09-03 22:14:08 +0100
commit79ca9ff0fd334f0f502b86193a2b6acdbef1d089 (patch)
tree91746936e0360003f1f0c8a83318419e5a4edf36
parent3286c8084aa3970dbba5200774a5c38481a8750a (diff)
add CommandSequenceCommand
a meta command that allows to chain commands
-rw-r--r--alot/commands/globals.py13
-rw-r--r--alot/ui.py1
2 files changed, 14 insertions, 0 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 587cfa48..0f417851 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -749,3 +749,16 @@ class ComposeCommand(Command):
spawn=self.force_spawn,
refocus=False)
ui.apply_command(cmd)
+
+
+class CommandSequenceCommand(Command):
+ """Meta-Command that just applies a sequence of given Commands in order"""
+
+ def __init__(self, commandlist=[]):
+ self.commandlist = commandlist
+
+ @inlineCallbacks
+ def apply(self, ui):
+ for cmd in self.commandlist:
+ logging.debug('CMDSEQ: apply %s' % str(cmd))
+ yield ui.apply(cmd)
diff --git a/alot/ui.py b/alot/ui.py
index cb9f16d2..81d61556 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -523,3 +523,4 @@ class UI(object):
d = defer.maybeDeferred(cmd.apply, self)
d.addErrback(errorHandler)
d.addCallback(call_posthook)
+ return d