Mercurial > libervia-backend
diff frontends/src/primitivus/chat.py @ 2029:62a99c214b57
primitivus, quick frontend (chat): moved time text generation to QuickChat
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Aug 2016 21:05:04 +0200 |
parents | 01aff34e8873 |
children | 7834743705f0 |
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py Mon Aug 08 00:50:01 2016 +0200 +++ b/frontends/src/primitivus/chat.py Mon Aug 08 21:05:04 2016 +0200 @@ -30,8 +30,6 @@ from sat_frontends.primitivus.keys import action_key_map as a_key from sat_frontends.primitivus.widget import PrimitivusWidget from sat_frontends.primitivus.contact_list import ContactList -import time -import locale from functools import total_ordering import bisect @@ -47,7 +45,6 @@ """ self.mess_data = mess_data mess_data.widgets.add(self) - self.timestamp = time.localtime(mess_data.timestamp) super(MessageWidget, self).__init__(urwid.Text(self.markup)) @property @@ -119,10 +116,8 @@ # timestamp if self.parent.show_timestamp: - # if the message was sent before today, we print the full date - time_format = u"%c" if self.timestamp < self.parent.day_change else u"%H:%M" attr = 'msg_mention' if mention else 'date' - markup.append((attr, u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1])))) + markup.append((attr, u"[{}]".format(d.time_text))) else: if mention: markup.append(('msg_mention', '[*]')) @@ -284,7 +279,6 @@ # focus marker is a separator indicated last visible message before focus was lost self.focus_marker = None # link to current marker self.focus_marker_set = None # True if a new marker has been inserted - self.day_change = time.strptime(time.strftime("%a %b %d 00:00:00 %Y")) # struct_time of day changing time self.show_timestamp = True self.show_short_nick = False self.show_title = 1 # 0: clip title; 1: full title; 2: no title