diff options
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r-- | alot/commands/thread.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index bc1cc1a4..9d67456b 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -522,12 +522,16 @@ class EditNewCommand(Command): MODE, 'fold', help='change message folding level', arguments=[(['fold'], {'action': cargparse.ValidatedStoreAction, 'validator': cargparse.is_int_or_pm})]) +@registerCommand( + MODE, 'weight', help='change weight of the thread tree', + arguments=[(['weight'], {'action': cargparse.ValidatedStoreAction, + 'validator': cargparse.is_int_or_pm})]) class ChangeDisplaymodeCommand(Command): repeatable = True def __init__(self, query=None, raw=None, all_headers=None, - indent=None, fold = None, **kwargs): + indent=None, fold = None, weight = None, **kwargs): """ :param query: notmuch query string used to filter messages to affect :type query: str @@ -547,6 +551,7 @@ class ChangeDisplaymodeCommand(Command): self.all_headers = all_headers self.indent = indent self.fold = fold + self.weight = weight Command.__init__(self, **kwargs) def apply(self, ui): @@ -567,6 +572,17 @@ class ChangeDisplaymodeCommand(Command): tbuffer.rebuild() ui.update() + if self.weight is not None: + new_weight = tbuffer.msgtree_weight + if self.weight == '+': + new_weight += 0.1 + elif self.weight == '-': + new_weight -= 0.1 + else: + new_weight = self.weight + + tbuffer.msgtree_weight = new_weight + logging.debug('matching lines %s...', self.query) if self.query is None: msg_wgts = [tbuffer.get_selected_message_widget()] |