comparison cagou/plugins/plugin_wid_chat.kv @ 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 3e2333a11f61
comparison
equal deleted inserted replaced
412:7c6149c249c1 413:c466678c57b2
169 <Chat>: 169 <Chat>:
170 attachments_to_send: attachments_to_send 170 attachments_to_send: attachments_to_send
171 message_input: message_input 171 message_input: message_input
172 messages_widget: messages_widget 172 messages_widget: messages_widget
173 history_scroll: history_scroll 173 history_scroll: history_scroll
174 send_button_visible: G.local_platform.send_button_visible or bool(attachments_to_send.attachments.children)
174 ScrollView: 175 ScrollView:
175 id: history_scroll 176 id: history_scroll
176 scroll_y: 0 177 scroll_y: 0
177 on_scroll_y: root.onScroll(*args) 178 on_scroll_y: root.onScroll(*args)
178 do_scroll_x: False 179 do_scroll_x: False
199 size_hint: 1, None 200 size_hint: 1, None
200 height: min(self.minimum_height, dp(250)) 201 height: min(self.minimum_height, dp(250))
201 multiline: True 202 multiline: True
202 hint_text: _(u"Enter your message here") 203 hint_text: _(u"Enter your message here")
203 on_text_validate: root.onSend(args[0]) 204 on_text_validate: root.onSend(args[0])
204 205 SymbolButton:
205 206 # "send" button, permanent visibility depends on platform
206 <SendButton>: 207 symbol: "forward"
207 # SendButton is only shown on touch devices 208 size_hint: None, 1
208 symbol: "forward" 209 width: dp(30) if root.send_button_visible else 0
209 size_hint: None, 1 210 opacity: 1 if root.send_button_visible else 0
210 width: dp(30) 211 font_size: dp(25)
211 font_size: dp(25) 212 on_release: self.parent.send_text()
212 on_release: self.message_input_box.send_text() 213
213 214
214 # Buttons added in header 215 # Buttons added in header
215 216
216 <TransferButton>: 217 <TransferButton>:
217 size_hint: None, 1 218 size_hint: None, 1