summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatrick <p.totzke@ed.ac.uk>2011-08-18 14:13:32 +0100
committerpatrick <p.totzke@ed.ac.uk>2011-08-18 14:13:32 +0100
commit43822fe770e2baa89c4e4338929eaee28555f205 (patch)
tree773b230c6b44ca63559f2f69cbd01b5d5c4599cf
parentad0897d6a40b29d5afb36b35307815428267f30b (diff)
parentb48f9532ce3dcf96c724a837ce604ea213c423de (diff)
Merge branch 'timestamps-17' into develop
-rw-r--r--alot/message.py13
-rw-r--r--alot/settings.py1
-rw-r--r--alot/widgets.py7
-rw-r--r--data/example.full.rc6
4 files changed, 22 insertions, 5 deletions
diff --git a/alot/message.py b/alot/message.py
index d464fdfd..29f8896f 100644
--- a/alot/message.py
+++ b/alot/message.py
@@ -26,6 +26,7 @@ from email.header import Header
import helper
from settings import get_mime_handler
+from settings import config
class Message:
@@ -55,7 +56,6 @@ class Message:
aname, aaddress = self.get_author()
if not aname:
aname = aaddress
- #tags = ','.join(self.get_tags())
return "%s (%s)" % (aname, self.get_datestring())
def __hash__(self):
@@ -116,9 +116,14 @@ class Message:
t = self.get_thread()
return t.get_replies_to(self)
- def get_datestring(self, pretty=True):
- """returns formated datestring in sup-style, eg: 'Yest.3pm'"""
- return helper.pretty_datetime(self._datetime)
+ def get_datestring(self):
+ """returns formated datestring"""
+ formatstring = config.get('general', 'timestamp_format')
+ if formatstring:
+ res = self._datetime.strftime(formatstring)
+ else:
+ res = helper.pretty_datetime(self._datetime)
+ return res
def get_author(self):
"""returns realname and address pair of this messages author"""
diff --git a/alot/settings.py b/alot/settings.py
index dd399fcd..6bba50ad 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -39,6 +39,7 @@ DEFAULTS = {
'flush_retry_timeout': '5',
'hooksfile': '~/.alot.py',
'bug_on_exit': 'False',
+ 'timestamp_format': '',
},
'16c-theme': {
'bufferlist_focus_bg': 'dark gray',
diff --git a/alot/widgets.py b/alot/widgets.py
index 34faa179..690c6260 100644
--- a/alot/widgets.py
+++ b/alot/widgets.py
@@ -40,7 +40,12 @@ class ThreadlineWidget(urwid.AttrMap):
def rebuild(self):
cols = []
- datestring = pretty_datetime(self.thread.get_newest_date()).rjust(10)
+ formatstring = config.get('general', 'timestamp_format')
+ newest = self.thread.get_newest_date()
+ if formatstring:
+ datestring = newest.strftime(formatstring)
+ else:
+ datestring = pretty_datetime(newest).rjust(10)
self.date_w = urwid.AttrMap(urwid.Text(datestring), 'threadline_date')
cols.append(('fixed', len(datestring), self.date_w))
diff --git a/data/example.full.rc b/data/example.full.rc
index f6ebb1ef..1ce75d77 100644
--- a/data/example.full.rc
+++ b/data/example.full.rc
@@ -3,6 +3,7 @@
ask_subject = True
# max length of authors line in thread widgets
authors_maxlength = 30
+# confirm exit
bug_on_exit = False
# number of colours your terminal supports
colourmode = 256
@@ -22,6 +23,11 @@ spawn_editor = False
# set terminal for asynchronous editing
terminal_cmd = x-terminal-emulator -e
+# strftime format for timestamps. Note: you must escape % here:
+# use '%%' instead of '%'. otherwise see
+# http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+timestamp_format = ''
+
[global-maps]
$ = flush
: = prompt