From 216c1203aa0652e24c83a4adbb663bd797efabf7 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 23 Dec 2016 11:00:40 -0800 Subject: fix odd continuation and indentation This is just whitespace changes. --- alot/buffers.py | 12 +++---- alot/commands/envelope.py | 55 ++++++++++++++++++------------ alot/commands/globals.py | 55 ++++++++++++++++-------------- alot/commands/search.py | 79 +++++++++++++++++++++++-------------------- alot/commands/thread.py | 86 ++++++++++++++++++++++++++--------------------- alot/settings/theme.py | 10 +++--- alot/widgets/utils.py | 3 +- 7 files changed, 165 insertions(+), 135 deletions(-) (limited to 'alot') diff --git a/alot/buffers.py b/alot/buffers.py index 430d53cd..9a2672b2 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -362,12 +362,12 @@ class ThreadBuffer(Buffer): bars_att = settings.get_theming_attribute('thread', 'arrow_bars') heads_att = settings.get_theming_attribute('thread', 'arrow_heads') - A = ArrowTree(self._tree, - indent=2, - childbar_offset=0, - arrow_tip_att=heads_att, - arrow_att=bars_att, - ) + A = ArrowTree( + self._tree, + indent=2, + childbar_offset=0, + arrow_tip_att=heads_att, + arrow_att=bars_att) self._nested_tree = NestedTree(A, interpret_covered=True) self.body = TreeBox(self._nested_tree) self.message_count = self.thread.get_total_messages() diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 69b63f3a..7ce553b6 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -30,8 +30,9 @@ from ..utils.booleanaction import BooleanAction MODE = 'envelope' -@registerCommand(MODE, 'attach', arguments=[ - (['path'], {'help': 'file(s) to attach (accepts wildcads)'})]) +@registerCommand( + MODE, 'attach', + arguments=[(['path'], {'help': 'file(s) to attach (accepts wildcads)'})]) class AttachCommand(Command): """attach files to the mail""" repeatable = True @@ -443,13 +444,18 @@ class ToggleHeaderCommand(Command): ui.current_buffer.toggle_all_headers() -@registerCommand(MODE, 'sign', forced={'action': 'sign'}, arguments=[ - (['keyid'], {'nargs': argparse.REMAINDER, 'help': 'which key id to use'})], +@registerCommand( + MODE, 'sign', forced={'action': 'sign'}, + arguments=[ + (['keyid'], + {'nargs': argparse.REMAINDER, 'help': 'which key id to use'})], help='mark mail to be signed before sending') @registerCommand(MODE, 'unsign', forced={'action': 'unsign'}, help='mark mail not to be signed before sending') -@registerCommand(MODE, 'togglesign', forced={'action': 'toggle'}, arguments=[ - (['keyid'], {'nargs': argparse.REMAINDER, 'help': 'which key id to use'})], +@registerCommand( + MODE, 'togglesign', forced={'action': 'toggle'}, arguments=[ + (['keyid'], + {'nargs': argparse.REMAINDER, 'help': 'which key id to use'})], help='toggle sign status') class SignCommand(Command): """toggle signing this email""" @@ -497,25 +503,30 @@ class SignCommand(Command): ui.current_buffer.rebuild() -@registerCommand(MODE, 'encrypt', forced={'action': 'encrypt'}, arguments=[ - (['--trusted'], {'action': 'store_true', 'help': 'only add trusted keys'}), - (['keyids'], {'nargs': argparse.REMAINDER, - 'help': 'keyid of the key to encrypt with'})], +@registerCommand( + MODE, 'encrypt', forced={'action': 'encrypt'}, arguments=[ + (['--trusted'], {'action': 'store_true', + 'help': 'only add trusted keys'}), + (['keyids'], {'nargs': argparse.REMAINDER, + 'help': 'keyid of the key to encrypt with'})], help='request encryption of message before sendout') -@registerCommand(MODE, 'unencrypt', forced={'action': 'unencrypt'}, - help='remove request to encrypt message before sending') -@registerCommand(MODE, 'toggleencrypt', forced={'action': 'toggleencrypt'}, - arguments=[ - (['--trusted'], {'action': 'store_true', - 'help': 'only add trusted keys'}), - (['keyids'], {'nargs': argparse.REMAINDER, +@registerCommand( + MODE, 'unencrypt', forced={'action': 'unencrypt'}, + help='remove request to encrypt message before sending') +@registerCommand( + MODE, 'toggleencrypt', forced={'action': 'toggleencrypt'}, + arguments=[ + (['--trusted'], {'action': 'store_true', + 'help': 'only add trusted keys'}), + (['keyids'], {'nargs': argparse.REMAINDER, 'help': 'keyid of the key to encrypt with'})], - help='toggle if message should be encrypted before sendout') -@registerCommand(MODE, 'rmencrypt', forced={'action': 'rmencrypt'}, - arguments=[ - (['keyids'], {'nargs': argparse.REMAINDER, + help='toggle if message should be encrypted before sendout') +@registerCommand( + MODE, 'rmencrypt', forced={'action': 'rmencrypt'}, + arguments=[ + (['keyids'], {'nargs': argparse.REMAINDER, 'help': 'keyid of the key to encrypt with'})], - help='do not encrypt to given recipient key') + help='do not encrypt to given recipient key') class EncryptCommand(Command): def __init__(self, action=None, keyids=None, trusted=False, **kwargs): """ diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 294abcd4..5090e653 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -64,7 +64,7 @@ class ExitCommand(Command): @registerCommand(MODE, 'search', usage='search query', arguments=[ (['--sort'], {'help': 'sort order', 'choices': [ - 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), + 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), (['query'], {'nargs': argparse.REMAINDER, 'help': 'search string'})]) class SearchCommand(Command): @@ -123,11 +123,11 @@ class PromptCommand(Command): logging.info('open command shell') mode = ui.mode or 'global' cmpl = CommandLineCompleter(ui.dbman, mode, ui.current_buffer) - cmdline = yield ui.prompt('', - text=self.startwith, - completer=cmpl, - history=ui.commandprompthistory, - ) + cmdline = yield ui.prompt( + '', + text=self.startwith, + completer=cmpl, + history=ui.commandprompthistory) logging.debug('CMDLINE: %s', cmdline) # interpret and apply commandline @@ -150,14 +150,16 @@ class RefreshCommand(Command): ui.update() -@registerCommand(MODE, 'shellescape', arguments=[ - (['--spawn'], {'action': BooleanAction, 'default': None, - 'help': 'run in terminal window'}), - (['--thread'], {'action': BooleanAction, 'default': None, - 'help': 'run in separate thread'}), - (['--refocus'], {'action': BooleanAction, 'help': 'refocus current buffer \ - after command has finished'}), - (['cmd'], {'help': 'command line to execute'})], +@registerCommand( + MODE, 'shellescape', arguments=[ + (['--spawn'], {'action': BooleanAction, 'default': None, + 'help': 'run in terminal window'}), + (['--thread'], {'action': BooleanAction, 'default': None, + 'help': 'run in separate thread'}), + (['--refocus'], {'action': BooleanAction, + 'help': 'refocus current buffer after command ' + 'has finished'}), + (['cmd'], {'help': 'command line to execute'})], forced={'shell': True}, ) class ExternalCommand(Command): @@ -380,10 +382,11 @@ class CallCommand(Command): @registerCommand(MODE, 'bclose', arguments=[ - (['--redraw'], {'action': BooleanAction, 'help': 'redraw current buffer \ - after command has finished'}), - (['--force'], {'action': 'store_true', - 'help': 'never ask for confirmation'})]) + (['--redraw'], + {'action': BooleanAction, + 'help': 'redraw current buffer after command has finished'}), + (['--force'], + {'action': 'store_true', 'help': 'never ask for confirmation'})]) class BufferCloseCommand(Command): """close a buffer""" @@ -429,8 +432,9 @@ class BufferCloseCommand(Command): help='focus previous buffer') @registerCommand(MODE, 'bnext', forced={'offset': +1}, help='focus next buffer') -@registerCommand(MODE, 'buffer', arguments=[ - (['index'], {'type': int, 'help': 'buffer index to focus'}), ], +@registerCommand( + MODE, 'buffer', + arguments=[(['index'], {'type': int, 'help': 'buffer index to focus'})], help='focus buffer with given index') class BufferFocusCommand(Command): @@ -908,11 +912,12 @@ class ComposeCommand(Command): envelope.encrypt = False -@registerCommand(MODE, 'move', help='move focus in current buffer', - arguments=[(['movement'], { - 'nargs': argparse.REMAINDER, - 'help': 'up, down, [half]page up, ' - '[half]page down, first'})]) +@registerCommand( + MODE, 'move', help='move focus in current buffer', + arguments=[ + (['movement'], + {'nargs': argparse.REMAINDER, + 'help': 'up, down, [half]page up, [half]page down, first'})]) class MoveCommand(Command): """move in widget""" diff --git a/alot/commands/search.py b/alot/commands/search.py index 63572e68..5fb8324a 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -42,11 +42,11 @@ class OpenThreadCommand(Command): @registerCommand(MODE, 'refine', help='refine query', arguments=[ (['--sort'], {'help': 'sort order', 'choices': [ - 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), + 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), (['query'], {'nargs': argparse.REMAINDER, 'help': 'search string'})]) @registerCommand(MODE, 'sort', help='set sort order', arguments=[ (['sort'], {'help': 'sort order', 'choices': [ - 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), + 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), ]) class RefineCommand(Command): @@ -110,42 +110,50 @@ class RetagPromptCommand(Command): return ui.apply_command(PromptCommand('retag ' + initial_tagstring)) -@registerCommand(MODE, 'tag', forced={'action': 'add'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': - False, 'help': 'retag all messages in search result'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'tag', forced={'action': 'add'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': + False, 'help': 'retag all messages in search result'}), + (['tags'], {'help': 'comma separated list of tags'})], help='add tags to all messages in the thread that match the current query', ) -@registerCommand(MODE, 'retag', forced={'action': 'set'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': - False, 'help': 'retag all messages in search result'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'retag', forced={'action': 'set'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': + False, 'help': 'retag all messages in search result'}), + (['tags'], {'help': 'comma separated list of tags'})], help='set tags of all messages in the thread that match the current query', ) -@registerCommand(MODE, 'untag', forced={'action': 'remove'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': - False, 'help': 'retag all messages in search result'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'untag', forced={'action': 'remove'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': + False, 'help': 'retag all messages in search result'}), + (['tags'], {'help': 'comma separated list of tags'})], help='remove tags from all messages in the thread that match the query', ) -@registerCommand(MODE, 'toggletags', forced={'action': 'toggle'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['tags'], {'help': 'comma separated list of tags'})], - help="""flip presence of tags on this thread. - A tag is considered present if at least one message contained in this - thread is tagged with it. In that case this command will remove the tag - from every message in the thread.""") +@registerCommand( + MODE, 'toggletags', forced={'action': 'toggle'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['tags'], {'help': 'comma separated list of tags'})], + help='flip presence of tags on this thread. A tag is considered present ' + 'if at least one message contained in this thread is tagged with it. ' + 'In that case this command will remove the tag from every message in ' + 'the thread.') class TagCommand(Command): """manipulate message tags""" @@ -240,10 +248,9 @@ class TagCommand(Command): ui.apply_command(commands.globals.FlushCommand(callback=refresh)) -@registerCommand(MODE, 'move', help='move focus in search buffer', - arguments=[(['movement'], { - 'nargs': argparse.REMAINDER, - 'help': 'last'})]) +@registerCommand( + MODE, 'move', help='move focus in search buffer', + arguments=[(['movement'], {'nargs': argparse.REMAINDER, 'help': 'last'})]) class MoveFocusCommand(MoveCommand): def apply(self, ui): diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 90b68960..34256c05 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -491,11 +491,12 @@ class EditNewCommand(Command): omit_signature=True)) -@registerCommand(MODE, 'fold', forced={'visible': False}, arguments=[ - ( - ['query'], {'help': 'query used to filter messages to affect', - 'nargs': '*'}), -], +@registerCommand( + MODE, 'fold', forced={'visible': False}, + arguments=[ + (['query'], {'help': 'query used to filter messages to affect', + 'nargs': '*'}) + ], help='fold message(s)') @registerCommand(MODE, 'unfold', forced={'visible': True}, arguments=[ (['query'], {'help': 'query used to filter messages to affect', @@ -599,8 +600,7 @@ class ChangeDisplaymodeCommand(Command): 'help': 'display cmd\'s stdout as notification'}), (['--field_key'], {'help': 'mailcap field key for decoding', 'default': 'copiousoutput'}), -], -) +]) class PipeCommand(Command): """pipe message(s) to stdin of a shellcommand""" @@ -798,8 +798,7 @@ class RemoveCommand(Command): 'help': 'call print command once for each message'}), (['--add_tags'], {'action': 'store_true', 'help': 'add \'Tags\' header to the message'}), -], -) +]) class PrintCommand(PipeCommand): """print message(s)""" @@ -929,7 +928,7 @@ class OpenAttachmentCommand(Command): handler_raw_commandstring = entry['view'] # read parameter part = self.attachment.get_mime_representation() - parms = tuple('='.join(p) for p in part.get_params()) + parms = tuple('='.join(p) for p in part.get_params()) # in case the mailcap defined command contains no '%s', # we pipe the files content to the handling command via stdin @@ -972,11 +971,12 @@ class OpenAttachmentCommand(Command): ui.notify('unknown mime type') -@registerCommand(MODE, 'move', help='move focus in current buffer', - arguments=[(['movement'], { - 'nargs': argparse.REMAINDER, - 'help': 'up, down, page up, ' - 'page down, first, last'})]) +@registerCommand( + MODE, 'move', help='move focus in current buffer', + arguments=[ + (['movement'], + {'nargs': argparse.REMAINDER, + 'help': 'up, down, page up, page down, first, last'})]) class MoveFocusCommand(MoveCommand): def apply(self, ui): @@ -1022,36 +1022,44 @@ class ThreadSelectCommand(Command): ui.apply_command(ChangeDisplaymodeCommand(visible='toggle')) -@registerCommand(MODE, 'tag', forced={'action': 'add'}, arguments=[ - (['--all'], {'action': 'store_true', - 'help': 'tag all messages in thread'}), - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'help': 'postpone a writeout to the index'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'tag', forced={'action': 'add'}, + arguments=[ + (['--all'], {'action': 'store_true', + 'help': 'tag all messages in thread'}), + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'help': 'postpone a writeout to the index'}), + (['tags'], {'help': 'comma separated list of tags'})], help='add tags to message(s)', ) -@registerCommand(MODE, 'retag', forced={'action': 'set'}, arguments=[ - (['--all'], {'action': 'store_true', - 'help': 'tag all messages in thread'}), - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'help': 'postpone a writeout to the index'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'retag', forced={'action': 'set'}, + arguments=[ + (['--all'], {'action': 'store_true', + 'help': 'tag all messages in thread'}), + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'help': 'postpone a writeout to the index'}), + (['tags'], {'help': 'comma separated list of tags'})], help='set message(s) tags.', ) -@registerCommand(MODE, 'untag', forced={'action': 'remove'}, arguments=[ - (['--all'], {'action': 'store_true', - 'help': 'tag all messages in thread'}), - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'help': 'postpone a writeout to the index'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'untag', forced={'action': 'remove'}, + arguments=[ + (['--all'], {'action': 'store_true', + 'help': 'tag all messages in thread'}), + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'help': 'postpone a writeout to the index'}), + (['tags'], {'help': 'comma separated list of tags'})], help='remove tags from message(s)', ) -@registerCommand(MODE, 'toggletags', forced={'action': 'toggle'}, arguments=[ - (['--all'], {'action': 'store_true', - 'help': 'tag all messages in thread'}), - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'help': 'postpone a writeout to the index'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'toggletags', forced={'action': 'toggle'}, + arguments=[ + (['--all'], {'action': 'store_true', + 'help': 'tag all messages in thread'}), + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'help': 'postpone a writeout to the index'}), + (['tags'], {'help': 'comma separated list of tags'})], help='flip presence of tags on message(s)', ) class TagCommand(Command): diff --git a/alot/settings/theme.py b/alot/settings/theme.py index 0e9ced2a..7c4dac15 100644 --- a/alot/settings/theme.py +++ b/alot/settings/theme.py @@ -106,11 +106,11 @@ class Theme(object): candidates = self._config['search'].sections for candidatename in candidates: candidate = self._config['search'][candidatename] - if candidatename.startswith('threadline') and\ - (not candidatename == 'threadline') and\ - matches(candidate, thread): - match = candidate - break + if (candidatename.startswith('threadline') and + (not candidatename == 'threadline') and + matches(candidate, thread)): + match = candidate + break # fill in values res = {} diff --git a/alot/widgets/utils.py b/alot/widgets/utils.py index ce64a6eb..15a2c60b 100644 --- a/alot/widgets/utils.py +++ b/alot/widgets/utils.py @@ -33,8 +33,7 @@ class DialogBox(urwid.WidgetWrap): align='center', valign='top', width=len(title), - height=None, - ) + height=None) urwid.WidgetWrap.__init__(self, box) def selectable(self): -- cgit v1.2.3