Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_wid_chat.py @ 437:b5e6d36fbf9c
chat: set AttachmentImageItem in python instead of kv:
"source" is a StringProperty, and setting it in kv was in some case resulting in a "None"
set, which was leading to a crash when Kivy cache was purged.
It is now set in Python to avoid this problem.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 07 Mar 2020 00:05:49 +0100 |
parents | 53bb3886b408 |
children | ff548846df91 |
comparison
equal
deleted
inserted
replaced
436:036ff0ed7474 | 437:b5e6d36fbf9c |
---|---|
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_data(self, __, data): | |
136 source = data.get('preview') or data.get('path') or data.get('url') | |
137 if source: | |
138 self.source = source | |
139 | |
135 | 140 |
136 class AttachmentImagesCollectionItem(ButtonBehavior, GridLayout): | 141 class AttachmentImagesCollectionItem(ButtonBehavior, GridLayout): |
137 attachments = properties.ListProperty([]) | 142 attachments = properties.ListProperty([]) |
138 chat = properties.ObjectProperty() | 143 chat = properties.ObjectProperty() |
139 mess_data = properties.ObjectProperty() | 144 mess_data = properties.ObjectProperty() |