commit 99d614d8b700c4860f410ab0726a033ea6f3d99e
parent 1536e49ab8ab7369e1042fbee5efb1d0ba0b36fd
Author: Eric Davis <edavis@insanum.com>
Date: Mon, 14 Jul 2014 22:10:31 -0700
easier adjustment of column widths in help view
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/view_help.py b/view_help.py
@@ -6,6 +6,9 @@ class ViewHelp(urwid.ListBox):
def __init__(self, config):
self.config = config
+ self.descr_width = 26
+ self.config_width = 29
+
lines = []
lines.extend(self.create_kb_help_lines(u'Keybinds Common', 'common'))
lines.extend(self.create_kb_help_lines(u'Keybinds Note List', 'titles'))
@@ -51,8 +54,8 @@ def create_kb_help_lines(self, header, use):
urwid.AttrMap(urwid.AttrMap(
urwid.Text(
[
- ('help_descr', '{:>24} '.format(self.config.get_keybind_descr(c))),
- ('help_config', '{:>25} '.format(u'kb_' + c)),
+ ('help_descr', ('{:>' + str(self.descr_width) + '} ').format(self.config.get_keybind_descr(c))),
+ ('help_config', ('{:>' + str(self.config_width) + '} ').format(u'kb_' + c)),
('help_value', u"'" + self.config.get_keybind(c) + u"'")
]
),
@@ -78,8 +81,8 @@ def create_config_help_lines(self):
urwid.AttrMap(urwid.AttrMap(
urwid.Text(
[
- ('help_descr', '{:>24} '.format(self.config.get_config_descr(c))),
- ('help_config', '{:>25} '.format(u'cfg_' + c)),
+ ('help_descr', ('{:>' + str(self.descr_width) + '} ').format(self.config.get_config_descr(c))),
+ ('help_config', ('{:>' + str(self.config_width) + '} ').format(u'cfg_' + c)),
('help_value', u"'" + self.config.get_config(c) + u"'")
]
),
@@ -107,10 +110,9 @@ def create_color_help_lines(self):
urwid.AttrMap(urwid.AttrMap(
urwid.Text(
[
- ('help_descr', '{:>24} '.format(self.config.get_color_descr(c))),
- ('help_config', '{:>25} '.format(u'clr_' + c)),
- (re.search('^(.*)(_fg|_bg)$', c).group(1),
- u"'" + self.config.get_color(c) + u"'")
+ ('help_descr', ('{:>' + str(self.descr_width) + '} ').format(self.config.get_color_descr(c))),
+ ('help_config', ('{:>' + str(self.config_width) + '} ').format(u'clr_' + c)),
+ (re.search('^(.*)(_fg|_bg)$', c).group(1), u"'" + self.config.get_color(c) + u"'")
]
),
attr_map = None,