diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-06-26 20:01:09 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-06-26 20:01:09 +0100 |
commit | df1d735350ff3f07c2df35b62b8362c1142ac03d (patch) | |
tree | 41935cb0a41ca77d34a48d785bd58f0dbd360860 /alot/ui.py | |
parent | 56106958986ec66b22e4ccbe4426a9a9a76b4157 (diff) | |
parent | 4bc109095927a40defad6eff9c63a6eb80ce1820 (diff) |
Merge branch '0.3.1-feature-statusline-474'
Diffstat (limited to 'alot/ui.py')
-rw-r--r-- | alot/ui.py | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -11,6 +11,7 @@ from buffers import BufferlistBuffer import commands from commands import commandfactory from alot.commands import CommandParseError +from alot.helper import string_decode import widgets @@ -416,13 +417,27 @@ class UI(object): def build_statusbar(self): """construct and return statusbar widget""" - if self.current_buffer is not None: - idx = self.buffers.index(self.current_buffer) - lefttxt = '%d: %s' % (idx, self.current_buffer) - else: - lefttxt = '[no buffers]' + info = {} + cb = self.current_buffer + btype = None + + if cb is not None: + info = cb.get_info() + btype = cb.modename + info['buffer_no'] = self.buffers.index(cb) + info['buffer_type'] = btype + info['total_messages'] = self.dbman.count_messages('*') + info['pending_writes'] = len(self.dbman.writequeue) + + lefttxt = righttxt = u'' + if cb is not None: + lefttxt, righttxt = settings.get(btype + '_statusbar', (u'', u'')) + lefttxt = string_decode(lefttxt, 'UTF-8') + lefttxt = lefttxt.format(**info) + righttxt = string_decode(righttxt, 'UTF-8') + righttxt = righttxt.format(**info) + footerleft = urwid.Text(lefttxt, align='left') - righttxt = 'total messages: %d' % self.dbman.count_messages('*') pending_writes = len(self.dbman.writequeue) if pending_writes > 0: righttxt = ('|' * pending_writes) + ' ' + righttxt |