changeset 446:ffdf2390ea56

chat: fixed `source` assignment for `AttachmentImageItem`
author Goffi <goffi@goffi.org>
date Wed, 18 Mar 2020 20:26:21 +0100
parents 9b73a1879989
children f3296a7f35f3
files cagou/plugins/plugin_wid_chat.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Wed Mar 18 20:26:21 2020 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Wed Mar 18 20:26:21 2020 +0100
@@ -132,10 +132,15 @@
         gallery = ImagesGallery(sources=[full_size_source])
         G.host.showExtraUI(gallery)
 
+    def on_kv_post(self, __):
+        self.on_data(None, self.data)
+
     def on_data(self, __, data):
+        if self.image is None:
+            return
         source = data.get('preview') or data.get('path') or data.get('url')
         if source:
-            self.source = source
+            self.image.source = source
 
 
 class AttachmentImagesCollectionItem(ButtonBehavior, GridLayout):