quick frontends, primitivus: messageState signal handling

This commit is contained in:
Goffi 2016-08-02 23:11:44 +02:00
commit 2d468f9e94
2 changed files with 38 additions and 0 deletions

View file

@ -81,6 +81,7 @@ class MessageWidget(urwid.WidgetWrap):
def redraw(self):
self._w.set_text(self.markup)
self.mess_data.parent.host.redraw() # FIXME: should not be necessary
def selectable(self):
return True
@ -108,6 +109,14 @@ class MessageWidget(urwid.WidgetWrap):
d = self.mess_data
mention = d.mention
# message status
if d.status is None:
markup.append(u' ')
elif d.status == "delivered":
markup.append(('msg_status_received', u'✔'))
else:
log.warning(u"Unknown status: {}".format(d.status))
# timestamp
if self.parent.show_timestamp:
# if the message was sent before today, we print the full date
@ -134,6 +143,10 @@ class MessageWidget(urwid.WidgetWrap):
return markup
# events
def updated(self, attributes):
self.redraw()
@total_ordering
class OccupantWidget(urwid.WidgetWrap):

View file

@ -42,6 +42,7 @@ class Const(constants.Const):
('info_msg', 'yellow', 'default', 'bold'),
('msg_lang', 'dark cyan', 'default'),
('msg_mention', 'dark red, bold', 'default'),
('msg_status_received', 'light green, bold', 'default'),
('menubar', 'light gray,bold', 'dark red'),
('menubar_focus', 'light gray,bold', 'dark green'),