diff frontends/src/primitivus/chat.py @ 1980:2a85c818751a

primitivus (chat): mention is now visible by date in red instead of body (or a "[*]" if date is hidden)
author Goffi <goffi@goffi.org>
date Tue, 28 Jun 2016 18:31:08 +0200
parents 70e83ca721c8
children ab439ffe4113
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Tue Jun 28 18:29:56 2016 +0200
+++ b/frontends/src/primitivus/chat.py	Tue Jun 28 18:31:08 2016 +0200
@@ -117,12 +117,17 @@
         """Generate text markup according to message data and Widget options"""
         markup = []
         d = self.mess_data
+        mention = d.mention
 
         # 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"
-            markup.append(('date', u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1]))))
+            attr = 'msg_mention' if mention else 'date'
+            markup.append((attr, u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1]))))
+        else:
+            if mention:
+                markup.append(('msg_mention', '[*]'))
 
         # nickname
         if self.parent.show_short_nick:
@@ -136,10 +141,7 @@
             markup.append(("msg_lang", u"[{}] ".format(self.selected_lang)))
 
         # message body
-        if d.mention:
-            markup.append(("msg_mention", msg))
-        else:
-            markup.append(msg)
+        markup.append(msg)
 
         return markup