diff 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
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Sun Feb 23 15:39:03 2020 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Sun Feb 23 15:39:06 2020 +0100
@@ -210,21 +210,9 @@
             layout.add_widget(item)
 
 
-class SendButton(SymbolButton):
-    message_input_box = properties.ObjectProperty()
-
-
 class MessageInputBox(BoxLayout):
     message_input = properties.ObjectProperty()
 
-    def __init__(self, *args, **kwargs):
-        super(MessageInputBox, self).__init__(*args, **kwargs)
-        Clock.schedule_once(self.post_init, 0)
-
-    def post_init(self, *args):
-        if sys.platform == 'android':
-            self.add_widget(SendButton(message_input_box=self), 0)
-
     def send_text(self):
         self.message_input.send_text()
 
@@ -459,6 +447,7 @@
     messages_widget = properties.ObjectProperty()
     history_scroll = properties.ObjectProperty()
     attachments_to_send = properties.ObjectProperty()
+    send_button_visible = properties.BooleanProperty()
     use_header_input = True
     global_screen_manager = True
     collection_carousel = True