diff frontends/src/primitivus/chat.py @ 2024:01aff34e8873

quick frontends, primitivus: messageState signal handling
author Goffi <goffi@goffi.org>
date Tue, 02 Aug 2016 23:11:44 +0200
parents 88c41a195728
children 62a99c214b57
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Thu Jul 28 19:11:31 2016 +0200
+++ b/frontends/src/primitivus/chat.py	Tue Aug 02 23:11:44 2016 +0200
@@ -81,6 +81,7 @@
 
     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 @@
         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 @@
 
         return markup
 
+    # events
+    def updated(self, attributes):
+        self.redraw()
+
 @total_ordering
 class OccupantWidget(urwid.WidgetWrap):