# HG changeset patch # User Goffi # Date 1483919219 -3600 # Node ID c601e3d40342313584d11a13c4b1de0ec12746e7 # Parent 20251d926cc205db4be08df353a5a95ef22f215e chat: display delivery receipt (with a green check mark) diff -r 20251d926cc2 -r c601e3d40342 src/cagou/plugins/plugin_wid_chat.kv --- a/src/cagou/plugins/plugin_wid_chat.kv Thu Jan 05 20:36:41 2017 +0100 +++ b/src/cagou/plugins/plugin_wid_chat.kv Mon Jan 09 00:46:59 2017 +0100 @@ -48,6 +48,7 @@ height: self.minimum_height on_width: self.widthAdjust() avatar: avatar + delivery: delivery BoxLayout: id: header_box size_hint: 1, None @@ -62,6 +63,18 @@ size: self.texture_size padding: dp(5), 0 text: u"{}, {}".format(root.mess_data.nick, root.mess_data.time_text) + Label: + id: delivery + text_size: None, None + size_hint: None, None + size: self.texture_size + padding: dp(5), 0 + # XXX: DejaVuSans font is needed as check mark is not in Roboto + # this can be removed when Kivy will be able to handle fallback mechanism + # which will allow us to use fonts with more unicode characters + font_name: "DejaVuSans" + text: u'' + color: 0, 1, 0, 1 BoxLayout: # BoxLayout is needed here, else GridLayout won't let the Label choose its width size_hint: 1, None diff -r 20251d926cc2 -r c601e3d40342 src/cagou/plugins/plugin_wid_chat.py --- a/src/cagou/plugins/plugin_wid_chat.py Thu Jan 05 20:36:41 2017 +0100 +++ b/src/cagou/plugins/plugin_wid_chat.py Mon Jan 09 00:46:59 2017 +0100 @@ -526,6 +526,7 @@ mess_xhtml = properties.ObjectProperty() mess_padding = (dp(5), dp(5)) avatar = properties.ObjectProperty() + delivery = properties.ObjectProperty() def __init__(self, **kwargs): super(MessageWidget, self).__init__(**kwargs) @@ -564,6 +565,9 @@ def update(self, update_dict): if 'avatar' in update_dict: self.avatar.source = update_dict['avatar'] + if 'status' in update_dict: + status = update_dict['status'] + self.delivery.text = u'\u2714' if status == 'delivered' else u'' class MessageInputBox(BoxLayout):