diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-25 09:49:18 -0800 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-25 09:49:18 -0800 |
commit | ee328f77d97a6a7d95b5803ca8a18c091cb44f45 (patch) | |
tree | bc7ab1ca5ed73caf44ca11c6fe87e10450810174 | |
parent | b67d2cf9e7f49ee32ede94ecb286ed2cf99c44bb (diff) | |
parent | 462335a92e0888ff6875097b6d1e4a24e3a459d2 (diff) |
Merge pull request #360 from quite/prettydate
Squeeze the pretty datetime one or two chars
-rw-r--r-- | alot/widgets.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/alot/widgets.py b/alot/widgets.py index c5f1096d..2abb6464 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -7,6 +7,7 @@ from helper import pretty_datetime from helper import tag_cmp from helper import string_decode import message +import time class DialogBox(urwid.WidgetWrap): @@ -69,6 +70,10 @@ class ThreadlineWidget(urwid.AttrMap): * `search_thread_subject, search_thread_subject_focus` * `search_thread_content, search_thread_content_focus` """ + # The pretty_datetime needs 9 characters, but only 8 if locale + # doesn't use am/pm (in which case "jan 2012" is the longest) + pretty_datetime_len = 8 if len(time.strftime("%P")) == 0 else 9 + def __init__(self, tid, dbman): self.dbman = dbman #logging.debug('tid: %s' % tid) @@ -92,7 +97,7 @@ class ThreadlineWidget(urwid.AttrMap): else: formatstring = settings.get('timestamp_format') if formatstring is None: - datestring = pretty_datetime(newest).rjust(10) + datestring = pretty_datetime(newest).rjust(ThreadlineWidget.pretty_datetime_len) else: datestring = newest.strftime(formatstring) self.date_w = urwid.AttrMap(urwid.Text(datestring), |