summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-07-05 21:14:55 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-07-05 21:14:55 +0100
commit601a2a735ad32d5dd910f1d2f20f8b7b15fb1f58 (patch)
treeae6e2d2049795ea1e16cad037357a27788b40cee /alot
parent9965080461392e56780e58a04dcbd5688c94d3bf (diff)
add width_tuple configobj check
Diffstat (limited to 'alot')
-rw-r--r--alot/settings/checks.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/alot/settings/checks.py b/alot/settings/checks.py
index dc68827a..eff1370e 100644
--- a/alot/settings/checks.py
+++ b/alot/settings/checks.py
@@ -57,6 +57,26 @@ def align_mode(value):
raise VdtValueError
return value
+
+def width_tuple(value):
+ """
+ test if value is a valid width indicator (for a sub-widget in a column).
+ This can either be
+ ('fit', min, max): use the length actually needed for the content, padded to
+ use at least width min, and cut of at width max. Here, min
+ and max are positive integers or 0 to disable the boundary.
+ ('weight',n): have it relative weight of n compared to other columns.
+ Here, n is an int.
+ """
+ if value is None:
+ value = 'fit',0,0
+ elif not isinstance(value, (list, tuple)):
+ raise VdtTypeError(value)
+ elif value[0] not in ['fit', 'weight']:
+ raise VdtTypeError(value)
+ return value
+
+
def mail_container(value):
"""
Check that the value points to a valid mail container,