diff options
Diffstat (limited to 'alot/commands')
-rw-r--r-- | alot/commands/__init__.py | 2 | ||||
-rw-r--r-- | alot/commands/envelope.py | 18 | ||||
-rw-r--r-- | alot/commands/globals.py | 22 | ||||
-rw-r--r-- | alot/commands/search.py | 8 | ||||
-rw-r--r-- | alot/commands/taglist.py | 2 | ||||
-rw-r--r-- | alot/commands/thread.py | 18 |
6 files changed, 42 insertions, 28 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index cb84d366..8af721ae 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -14,7 +14,7 @@ from alot.helper import split_commandstring class Command(object): """base class for commands""" - repeatable = True + repeatable = False def __init__(self): self.prehook = None diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 98508fb4..84c1063e 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -30,6 +30,8 @@ MODE = 'envelope' (['path'], {'help': 'file(s) to attach (accepts wildcads)'})]) class AttachCommand(Command): """attach files to the mail""" + repeatable = True + def __init__(self, path=None, **kwargs): """ :param path: files to attach (globable string) @@ -61,8 +63,6 @@ class AttachCommand(Command): (['key'], {'help': 'header to refine'})]) class RefineCommand(Command): """prompt to change the value of a header""" - repeatable = False - def __init__(self, key='', **kwargs): """ :param key: key of the header to change @@ -80,8 +80,6 @@ class RefineCommand(Command): @registerCommand(MODE, 'save') class SaveCommand(Command): """save draft""" - repeatable = False - def apply(self, ui): envelope = ui.current_buffer.envelope @@ -118,8 +116,6 @@ class SaveCommand(Command): @registerCommand(MODE, 'send') class SendCommand(Command): """send mail""" - repeatable = False - def __init__(self, mail=None, envelope=None, **kwargs): """ :param mail: email to send @@ -250,8 +246,6 @@ class SendCommand(Command): 'help': 'refocus envelope after editing'})]) class EditCommand(Command): """edit mail""" - repeatable = False - def __init__(self, envelope=None, spawn=None, refocus=True, **kwargs): """ :param envelope: email to edit @@ -363,8 +357,6 @@ class EditCommand(Command): (['value'], {'nargs': '+', 'help': 'value'})]) class SetCommand(Command): """set header value""" - repeatable = False - def __init__(self, key, value, append=False, **kwargs): """ :param key: key of the header to change @@ -390,8 +382,6 @@ class SetCommand(Command): (['key'], {'help': 'header to refine'})]) class UnsetCommand(Command): """remove header field""" - repeatable = False - def __init__(self, key, **kwargs): """ :param key: key of the header to remove @@ -408,6 +398,8 @@ class UnsetCommand(Command): @registerCommand(MODE, 'toggleheaders') class ToggleHeaderCommand(Command): """toggle display of all headers""" + repeatable = True + def apply(self, ui): ui.current_buffer.toggle_all_headers() @@ -422,6 +414,8 @@ class ToggleHeaderCommand(Command): help='toggle sign status') class SignCommand(Command): """toggle signing this email""" + repeatable = True + def __init__(self, action=None, keyid=None, **kwargs): """ :param action: whether to sign/unsign/toggle diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 81110c6b..42718f12 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -55,6 +55,8 @@ class ExitCommand(Command): (['query'], {'nargs':argparse.REMAINDER, 'help':'search string'})]) class SearchCommand(Command): """open a new search buffer""" + repeatable = True + def __init__(self, query, sort=None, **kwargs): """ :param query: notmuch querystring @@ -93,8 +95,6 @@ class SearchCommand(Command): (['startwith'], {'nargs':'?', 'default':'', 'help':'initial content'})]) class PromptCommand(Command): """prompts for commandline and interprets it upon select""" - repeatable = False - def __init__(self, startwith='', **kwargs): """ :param startwith: initial content of the prompt widget @@ -125,6 +125,8 @@ class PromptCommand(Command): @registerCommand(MODE, 'refresh') class RefreshCommand(Command): """refresh the current buffer""" + repeatable = True + def apply(self, ui): ui.current_buffer.rebuild() ui.update() @@ -142,6 +144,8 @@ class RefreshCommand(Command): ) class ExternalCommand(Command): """run external command""" + repeatable = True + def __init__(self, cmd, stdin=None, shell=False, spawn=False, refocus=True, thread=False, on_success=None, **kwargs): """ @@ -306,6 +310,8 @@ class EditCommand(ExternalCommand): @registerCommand(MODE, 'pyshell') class PythonShellCommand(Command): """open an interactive python shell for introspection""" + repeatable = True + def apply(self, ui): ui.mainloop.screen.stop() code.interact(local=locals()) @@ -315,8 +321,6 @@ class PythonShellCommand(Command): @registerCommand(MODE, 'repeat') class RepeatCommand(Command): """Repeats the command executed last time""" - repeatable = False - def __init__(self, **kwargs): Command.__init__(self, **kwargs) @@ -331,6 +335,8 @@ class RepeatCommand(Command): (['command'], {'help':'python command string to call'})]) class CallCommand(Command): """ Executes python code """ + repeatable = True + def __init__(self, command, **kwargs): """ :param command: python command string to call @@ -361,6 +367,8 @@ class CallCommand(Command): 'help': 'never ask for confirmation'})]) class BufferCloseCommand(Command): """close a buffer""" + repeatable = True + def __init__(self, buffer=None, force=False, redraw=True, **kwargs): """ :param buffer: the buffer to close or None for current @@ -406,6 +414,8 @@ class BufferCloseCommand(Command): help='focus buffer with given index') class BufferFocusCommand(Command): """focus a :class:`~alot.buffers.Buffer`""" + repeatable = True + def __init__(self, buffer=None, index=None, offset=0, **kwargs): """ :param buffer: the buffer to focus or None @@ -483,6 +493,8 @@ class TagListCommand(Command): @registerCommand(MODE, 'flush') class FlushCommand(Command): """flush write operations or retry until committed""" + repeatable = True + def __init__(self, callback=None, silent=False, **kwargs): """ :param callback: function to call after successful writeout @@ -810,8 +822,6 @@ class ComposeCommand(Command): 'help':'up, down, [half]page up, [half]page down, first'})]) class MoveCommand(Command): """move in widget""" - repeatable = False - def __init__(self, movement=None, **kwargs): if movement is None: self.movement = '' diff --git a/alot/commands/search.py b/alot/commands/search.py index e3576e68..a8ac188f 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -19,8 +19,6 @@ MODE = 'search' @registerCommand(MODE, 'select') class OpenThreadCommand(Command): """open thread in a new buffer""" - repeatable = False - def __init__(self, thread=None, **kwargs): """ :param thread: thread to open (Uses focussed thread if unset) @@ -82,7 +80,7 @@ class RefineCommand(Command): @registerCommand(MODE, 'refineprompt') class RefinePromptCommand(Command): """prompt to change this buffers querystring""" - repeatable = False + repeatable = True def apply(self, ui): sbuffer = ui.current_buffer @@ -93,8 +91,6 @@ class RefinePromptCommand(Command): @registerCommand(MODE, 'retagprompt') class RetagPromptCommand(Command): """prompt to retag selected threads\' tags""" - repeatable = False - def apply(self, ui): thread = ui.current_buffer.get_selected_thread() if not thread: @@ -148,6 +144,8 @@ class RetagPromptCommand(Command): """) class TagCommand(Command): """manipulate message tags""" + repeatable = True + def __init__(self, tags=u'', action='add', allmessages=False, flush=True, **kwargs): """ diff --git a/alot/commands/taglist.py b/alot/commands/taglist.py index 752e5716..c21a7c6a 100644 --- a/alot/commands/taglist.py +++ b/alot/commands/taglist.py @@ -10,8 +10,6 @@ MODE = 'taglist' @registerCommand(MODE, 'select') class TaglistSelectCommand(Command): """search for messages with selected tag""" - repeatable = False - def apply(self, ui): tagstring = ui.current_buffer.get_selected_tag() cmd = SearchCommand(query=['tag:"%s"' % tagstring]) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index b2c458f1..66e6343c 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -100,6 +100,8 @@ def determine_sender(mail, action='reply'): 'help': 'open editor in new window'})]) class ReplyCommand(Command): """reply to message""" + repeatable = True + def __init__(self, message=None, all=False, spawn=None, **kwargs): """ :param message: message to reply to (defaults to selected message) @@ -251,6 +253,8 @@ class ReplyCommand(Command): 'help': 'open editor in new window'})]) class ForwardCommand(Command): """forward message""" + repeatable = True + def __init__(self, message=None, attach=True, spawn=None, **kwargs): """ :param message: message to forward (defaults to selected message) @@ -328,6 +332,8 @@ class ForwardCommand(Command): @registerCommand(MODE, 'bounce') class BounceMailCommand(Command): """directly re-send selected message""" + repeatable = True + def __init__(self, message=None, **kwargs): """ :param message: message to bounce (defaults to selected message) @@ -451,6 +457,8 @@ class EditNewCommand(Command): help='display all headers') class ChangeDisplaymodeCommand(Command): """fold or unfold messages""" + repeatable = True + def __init__(self, query=None, visible=None, raw=None, all_headers=None, **kwargs): """ @@ -535,6 +543,8 @@ class ChangeDisplaymodeCommand(Command): ) class PipeCommand(Command): """pipe message(s) to stdin of a shellcommand""" + repeatable = True + def __init__(self, cmd, all=False, separately=False, background=False, shell=False, notify_stdout=False, format='raw', add_tags=False, noop_msg='no command specified', @@ -673,6 +683,8 @@ class PipeCommand(Command): (['--all'], {'action': 'store_true', 'help': 'remove whole thread'})]) class RemoveCommand(Command): """remove message(s) from the index""" + repeatable = True + def __init__(self, all=False, **kwargs): """ :param all: remove all messages from thread, not just selected one @@ -724,6 +736,8 @@ class RemoveCommand(Command): ) class PrintCommand(PipeCommand): """print message(s)""" + repeatable = True + def __init__(self, all=False, separately=False, raw=False, add_tags=False, **kwargs): """ @@ -923,8 +937,6 @@ class ThreadSelectCommand(Command): """select focussed element. The fired action depends on the focus: - if message summary, this toggles visibility of the message, - if attachment line, this opens the attachment""" - repeatable = False - def apply(self, ui): focus = ui.get_deep_focus() if isinstance(focus, AttachmentWidget): @@ -968,6 +980,8 @@ class ThreadSelectCommand(Command): ) class TagCommand(Command): """manipulate message tags""" + repeatable = True + def __init__(self, tags=u'', action='add', all=False, flush=True, **kwargs): """ |