diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-10 20:01:49 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-10 20:01:49 +0000 |
commit | b47e67fa180222403f9bbfb46ce8926a28b70f32 (patch) | |
tree | 252010c43e52ead33eaa6baef43cc675a47d6634 /alot | |
parent | c3d135ecfef90d5c23af6a20173fabd44ced24ce (diff) |
include mode string in Buffer.__str__
before, __str__ returned a mode identifier or additional info for the buffer. Now the
modestring is always included and is not artificially prepended for the buffers that only
yield additional info.
issue #143
Diffstat (limited to 'alot')
-rw-r--r-- | alot/buffers.py | 11 | ||||
-rw-r--r-- | alot/ui.py | 3 | ||||
-rw-r--r-- | alot/widgets.py | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/alot/buffers.py b/alot/buffers.py index 2c49ed7c..749ce274 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -16,9 +16,7 @@ class Buffer(object): self.body = widget def __str__(self): - # TODO rename this: its used to display this buffer - # in the buffer list and gets displayed in the footer - return self.typename + return '[%s]' % self.typename def render(self, size, focus=False): return self.body.render(size, focus) @@ -100,7 +98,7 @@ class EnvelopeBuffer(Buffer): def __str__(self): to = self.envelope.get('To', fallback='unset') - return "to: %s" % shorten_author_string(to, 400) + return '[%s] to: %s' % (self.typename, shorten_author_string(to, 400)) def get_email(self): """returns message represented as :class:`email.Message`""" @@ -162,7 +160,8 @@ class SearchBuffer(Buffer): Buffer.__init__(self, ui, self.body, 'search') def __str__(self): - return '%s (%d threads)' % (self.querystring, self.result_count) + formatstring = '[search] for "%s" (%d threads)' + return formatstring % (self.querystring, self.result_count) def cleanup(self): self.kill_filler_process() @@ -234,7 +233,7 @@ class ThreadBuffer(Buffer): Buffer.__init__(self, ui, self.body, 'thread') def __str__(self): - return '%s, (%d)' % (self.thread.get_subject(), self.message_count) + return '[thread] %s, (%d)' % (self.thread.get_subject(), self.message_count) def get_selected_thread(self): """returns the displayed :class:`~alot.db.Thread`""" @@ -419,8 +419,7 @@ class UI(object): def build_statusbar(self): """construct and return statusbar widget""" idx = self.buffers.index(self.current_buffer) - lefttxt = '%d: [%s] %s' % (idx, self.current_buffer.typename, - self.current_buffer) + lefttxt = '%d: %s' % (idx, self.current_buffer) footerleft = urwid.Text(lefttxt, align='left') righttxt = 'total messages: %d' % self.dbman.count_messages('*') pending_writes = len(self.dbman.writequeue) diff --git a/alot/widgets.py b/alot/widgets.py index 582857b3..3be5aafb 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -190,7 +190,7 @@ class BufferlineWidget(urwid.Text): def __init__(self, buffer): self.buffer = buffer - line = '[' + buffer.typename + '] ' + buffer.__str__() + line = buffer.__str__() urwid.Text.__init__(self, line, wrap='clip') def selectable(self): |