comparison cagou/plugins/plugin_wid_chat.kv @ 448:20a807443c3f

chat: resize attachments (images only for now): if attachments to send contain oversized image, a checkbox will be shown (activated by default) to reduce automatically the size. The background color now cover the whole attachments to send widget. If not already specified, media type is guessed from filename when adding an attachment.
author Goffi <goffi@goffi.org>
date Sun, 22 Mar 2020 14:10:59 +0100
parents f3296a7f35f3
children 6c21a5a44b54
comparison
equal deleted inserted replaced
447:f3296a7f35f3 448:20a807443c3f
170 on_press: root.parent.remove_widget(root) 170 on_press: root.parent.remove_widget(root)
171 171
172 172
173 <AttachmentsToSend>: 173 <AttachmentsToSend>:
174 attachments: attachments_layout.attachments 174 attachments: attachments_layout.attachments
175 reduce_checkbox: reduce_checkbox
175 orientation: "vertical" 176 orientation: "vertical"
176 size_hint: 1, None 177 size_hint: 1, None
177 height: self.minimum_height if self.attachments.children else 0 178 height: self.minimum_height if self.attachments.children else 0
178 opacity: 1 if self.attachments.children else 0 179 opacity: 1 if self.attachments.children else 0
179 padding: [app.MARGIN_LEFT, dp(5), app.MARGIN_RIGHT, dp(5)] 180 padding: [app.MARGIN_LEFT, dp(5), app.MARGIN_RIGHT, dp(5)]
181 canvas.before:
182 Color:
183 rgba: app.c_prim
184 Rectangle:
185 pos: self.pos
186 size: self.size
180 Label: 187 Label:
181 size_hint: 1, None 188 size_hint: 1, None
182 size: self.texture_size 189 size: self.texture_size
183 text: _("attachments:") 190 text: _("attachments:")
184 bold: True 191 bold: True
185 AttachmentsLayout: 192 AttachmentsLayout:
186 id: attachments_layout 193 id: attachments_layout
187 canvas.before: 194 BoxLayout:
188 Color: 195 id: resize_box
189 rgba: app.c_prim 196 size_hint: 1, None
190 Rectangle: 197 opacity: 1 if root.show_resize else 0
191 pos: self.pos 198 height: dp(25) if root.show_resize else 0
192 size: self.size 199 Widget:
193 200 CheckBox:
201 id: reduce_checkbox
202 size_hint: None, 1
203 width: dp(20)
204 active: True
205 Label:
206 size_hint: None, 1
207 text: _("reduce images size")
208 text_size: None, None
209 size: self.texture_size
210 valign: "middle"
211 padding_x: dp(10)
212 font_size: sp(15)
213 Widget:
194 214
195 <Chat>: 215 <Chat>:
196 attachments_to_send: attachments_to_send 216 attachments_to_send: attachments_to_send
197 message_input: message_input 217 message_input: message_input
198 messages_widget: messages_widget 218 messages_widget: messages_widget