comparison cagou/plugins/plugin_wid_chat.py @ 413:c466678c57b2

chat: control send button visibility in core.platform_, and show it when there are attachments
author Goffi <goffi@goffi.org>
date Sun, 23 Feb 2020 15:39:06 +0100
parents 7c6149c249c1
children 72a6b06728ab
comparison
equal deleted inserted replaced
412:7c6149c249c1 413:c466678c57b2
208 for attachment in attachments: 208 for attachment in attachments:
209 item = AttachmentItem(data=attachment) 209 item = AttachmentItem(data=attachment)
210 layout.add_widget(item) 210 layout.add_widget(item)
211 211
212 212
213 class SendButton(SymbolButton):
214 message_input_box = properties.ObjectProperty()
215
216
217 class MessageInputBox(BoxLayout): 213 class MessageInputBox(BoxLayout):
218 message_input = properties.ObjectProperty() 214 message_input = properties.ObjectProperty()
219
220 def __init__(self, *args, **kwargs):
221 super(MessageInputBox, self).__init__(*args, **kwargs)
222 Clock.schedule_once(self.post_init, 0)
223
224 def post_init(self, *args):
225 if sys.platform == 'android':
226 self.add_widget(SendButton(message_input_box=self), 0)
227 215
228 def send_text(self): 216 def send_text(self):
229 self.message_input.send_text() 217 self.message_input.send_text()
230 218
231 219
457 class Chat(quick_chat.QuickChat, cagou_widget.CagouWidget): 445 class Chat(quick_chat.QuickChat, cagou_widget.CagouWidget):
458 message_input = properties.ObjectProperty() 446 message_input = properties.ObjectProperty()
459 messages_widget = properties.ObjectProperty() 447 messages_widget = properties.ObjectProperty()
460 history_scroll = properties.ObjectProperty() 448 history_scroll = properties.ObjectProperty()
461 attachments_to_send = properties.ObjectProperty() 449 attachments_to_send = properties.ObjectProperty()
450 send_button_visible = properties.BooleanProperty()
462 use_header_input = True 451 use_header_input = True
463 global_screen_manager = True 452 global_screen_manager = True
464 collection_carousel = True 453 collection_carousel = True
465 454
466 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, nick=None, occupants=None, 455 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, nick=None, occupants=None,