# HG changeset patch # User Goffi # Date 1484499773 -3600 # Node ID ce6ef88f2cff94a84239ff220e378ef555f286bf # Parent 663e44f3009281d14098f80acc5b74ddd9564dc0 chat: avatar improvments: - avatar source is not set anymore in kv but on MessageWidget init, so None value can be handled correclty - Message widget add itself to mess_data before parsing kv, so call to properties in kv can update the widget correctly (specially important for embedded bridge) diff -r 663e44f30092 -r ce6ef88f2cff src/cagou/plugins/plugin_wid_chat.kv --- a/src/cagou/plugins/plugin_wid_chat.kv Mon Jan 09 00:47:03 2017 +0100 +++ b/src/cagou/plugins/plugin_wid_chat.kv Sun Jan 15 18:02:53 2017 +0100 @@ -56,7 +56,6 @@ height: avatar.height MessAvatar: id: avatar - source: root.mess_data.avatar Label: id: time_label text_size: None, None diff -r 663e44f30092 -r ce6ef88f2cff src/cagou/plugins/plugin_wid_chat.py --- a/src/cagou/plugins/plugin_wid_chat.py Mon Jan 09 00:47:03 2017 +0100 +++ b/src/cagou/plugins/plugin_wid_chat.py Sun Jan 15 18:02:53 2017 +0100 @@ -529,8 +529,12 @@ delivery = properties.ObjectProperty() def __init__(self, **kwargs): + # self must be registered in widgets before kv is parsed + kwargs['mess_data'].widgets.add(self) super(MessageWidget, self).__init__(**kwargs) - self.mess_data.widgets.add(self) + avatar_path = self.mess_data.avatar + if avatar_path is not None: + self.avatar.source = avatar_path @property def chat(self):