comparison cagou/plugins/plugin_wid_chat.py @ 446:ffdf2390ea56

chat: fixed `source` assignment for `AttachmentImageItem`
author Goffi <goffi@goffi.org>
date Wed, 18 Mar 2020 20:26:21 +0100
parents 61322ff8090b
children 20a807443c3f
comparison
equal deleted inserted replaced
445:9b73a1879989 446:ffdf2390ea56
130 def on_press(self): 130 def on_press(self):
131 full_size_source = self.data.get('path', self.data.get('url')) 131 full_size_source = self.data.get('path', self.data.get('url'))
132 gallery = ImagesGallery(sources=[full_size_source]) 132 gallery = ImagesGallery(sources=[full_size_source])
133 G.host.showExtraUI(gallery) 133 G.host.showExtraUI(gallery)
134 134
135 def on_kv_post(self, __):
136 self.on_data(None, self.data)
137
135 def on_data(self, __, data): 138 def on_data(self, __, data):
139 if self.image is None:
140 return
136 source = data.get('preview') or data.get('path') or data.get('url') 141 source = data.get('preview') or data.get('path') or data.get('url')
137 if source: 142 if source:
138 self.source = source 143 self.image.source = source
139 144
140 145
141 class AttachmentImagesCollectionItem(ButtonBehavior, GridLayout): 146 class AttachmentImagesCollectionItem(ButtonBehavior, GridLayout):
142 attachments = properties.ListProperty([]) 147 attachments = properties.ListProperty([])
143 chat = properties.ObjectProperty() 148 chat = properties.ObjectProperty()