Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_wid_chat.py @ 490:962d17c4078c
chat: changed KEY_ATTACHEMENTS* name following backend change
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Apr 2023 13:34:55 +0200 |
parents | 8f3cb8cd84d6 |
children | 203755bbe0fe |
comparison
equal
deleted
inserted
replaced
489:8f3cb8cd84d6 | 490:962d17c4078c |
---|---|
113 | 113 |
114 | 114 |
115 class AttachmentItem(BaseAttachmentItem): | 115 class AttachmentItem(BaseAttachmentItem): |
116 | 116 |
117 def get_symbol(self, data): | 117 def get_symbol(self, data): |
118 media_type = data.get(C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE, '') | 118 media_type = data.get(C.KEY_ATTACHMENTS_MEDIA_TYPE, '') |
119 main_type = media_type.split('/', 1)[0] | 119 main_type = media_type.split('/', 1)[0] |
120 if main_type == 'image': | 120 if main_type == 'image': |
121 return "file-image" | 121 return "file-image" |
122 elif main_type == 'video': | 122 elif main_type == 'video': |
123 return "file-video" | 123 return "file-video" |
346 image_attachments = [] | 346 image_attachments = [] |
347 other_attachments = [] | 347 other_attachments = [] |
348 # we first separate images and other attachments, so we know if we need | 348 # we first separate images and other attachments, so we know if we need |
349 # to use an image collection | 349 # to use an image collection |
350 for attachment in attachments: | 350 for attachment in attachments: |
351 media_type = attachment.get(C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE, '') | 351 media_type = attachment.get(C.KEY_ATTACHMENTS_MEDIA_TYPE, '') |
352 main_type = media_type.split('/', 1)[0] | 352 main_type = media_type.split('/', 1)[0] |
353 # GIF images are really badly handled by Kivy, the memory | 353 # GIF images are really badly handled by Kivy, the memory |
354 # consumption explode, and the images frequencies are not handled | 354 # consumption explode, and the images frequencies are not handled |
355 # correctly, thus we can't display them and we consider them as | 355 # correctly, thus we can't display them and we consider them as |
356 # other attachment, so user can open the item with appropriate | 356 # other attachment, so user can open the item with appropriate |
982 if item.sending: | 982 if item.sending: |
983 # the item is already being sent | 983 # the item is already being sent |
984 continue | 984 continue |
985 item.sending = True | 985 item.sending = True |
986 progress_id = item.data["progress_id"] = str(uuid.uuid4()) | 986 progress_id = item.data["progress_id"] = str(uuid.uuid4()) |
987 attachments = extra.setdefault(C.MESS_KEY_ATTACHMENTS, []) | 987 attachments = extra.setdefault(C.KEY_ATTACHMENTS, []) |
988 attachment = { | 988 attachment = { |
989 "path": str(item.data["path"]), | 989 "path": str(item.data["path"]), |
990 "progress_id": progress_id, | 990 "progress_id": progress_id, |
991 } | 991 } |
992 if 'media_type' in item.data: | 992 if 'media_type' in item.data: |
993 attachment[C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE] = item.data['media_type'] | 993 attachment[C.KEY_ATTACHMENTS_MEDIA_TYPE] = item.data['media_type'] |
994 | 994 |
995 if ((self.attachments_to_send.reduce_checkbox.active | 995 if ((self.attachments_to_send.reduce_checkbox.active |
996 and attachment.get('media_type', '').split('/')[0] == 'image')): | 996 and attachment.get('media_type', '').split('/')[0] == 'image')): |
997 attachment[C.MESS_KEY_ATTACHMENTS_RESIZE] = True | 997 attachment[C.KEY_ATTACHMENTS_RESIZE] = True |
998 | 998 |
999 attachments.append(attachment) | 999 attachments.append(attachment) |
1000 | 1000 |
1001 Clock.schedule_once( | 1001 Clock.schedule_once( |
1002 partial(self._attachmentProgressUpdate, item), | 1002 partial(self._attachmentProgressUpdate, item), |