Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
1979:70e83ca721c8 | 1980:2a85c818751a |
---|---|
115 | 115 |
116 def _generateMarkup(self): | 116 def _generateMarkup(self): |
117 """Generate text markup according to message data and Widget options""" | 117 """Generate text markup according to message data and Widget options""" |
118 markup = [] | 118 markup = [] |
119 d = self.mess_data | 119 d = self.mess_data |
120 mention = d.mention | |
120 | 121 |
121 # timestamp | 122 # timestamp |
122 if self.parent.show_timestamp: | 123 if self.parent.show_timestamp: |
123 # if the message was sent before today, we print the full date | 124 # if the message was sent before today, we print the full date |
124 time_format = u"%c" if self.timestamp < self.parent.day_change else u"%H:%M" | 125 time_format = u"%c" if self.timestamp < self.parent.day_change else u"%H:%M" |
125 markup.append(('date', u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1])))) | 126 attr = 'msg_mention' if mention else 'date' |
127 markup.append((attr, u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1])))) | |
128 else: | |
129 if mention: | |
130 markup.append(('msg_mention', '[*]')) | |
126 | 131 |
127 # nickname | 132 # nickname |
128 if self.parent.show_short_nick: | 133 if self.parent.show_short_nick: |
129 markup.append(('my_nick' if d.own_mess else 'other_nick', "**" if d.own_mess else "*")) | 134 markup.append(('my_nick' if d.own_mess else 'other_nick', "**" if d.own_mess else "*")) |
130 else: | 135 else: |
134 | 139 |
135 if self.selected_lang: | 140 if self.selected_lang: |
136 markup.append(("msg_lang", u"[{}] ".format(self.selected_lang))) | 141 markup.append(("msg_lang", u"[{}] ".format(self.selected_lang))) |
137 | 142 |
138 # message body | 143 # message body |
139 if d.mention: | 144 markup.append(msg) |
140 markup.append(("msg_mention", msg)) | |
141 else: | |
142 markup.append(msg) | |
143 | 145 |
144 return markup | 146 return markup |
145 | 147 |
146 @total_ordering | 148 @total_ordering |
147 class OccupantWidget(urwid.WidgetWrap): | 149 class OccupantWidget(urwid.WidgetWrap): |