summaryrefslogtreecommitdiff
path: root/alot/commands/thread.py
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-12-30 20:50:35 +0100
committerAnton Khirnov <anton@khirnov.net>2020-12-30 20:50:35 +0100
commitb190bf2980ce8944bdf2620e2c6442559712fdc2 (patch)
tree1d008b41a833b6ce464f2ec3a1a796899f8d4d04 /alot/commands/thread.py
parent6de0adba527a9d232068c209c152b12250b6d173 (diff)
buffers/thread: allow changing weights of the tree/message split
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r--alot/commands/thread.py18
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()]