annotate cagou/kv/widgets_handler.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 19422bbd9c8e
children 3c9ba4a694ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
282
1b835bcfa663 date update
Goffi <goffi@goffi.org>
parents: 154
diff changeset
2 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
13
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This program is free software: you can redistribute it and/or modify
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # it under the terms of the GNU Affero General Public License as published by
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # the Free Software Foundation, either version 3 of the License, or
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # (at your option) any later version.
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # GNU Affero General Public License for more details.
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # You should have received a copy of the GNU Affero General Public License
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
12a189fbb9ba widget handler first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
154
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
17 <WHWrapper>:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
18 _sp_top_y: self.y + self.height - self.sp_size
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
19 padding: self.split_size + self.split_margin, self.split_size + self.split_margin, 0, 0
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
20
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
21 canvas.before:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
22 # 2 lines to indicate the split zones
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
23 Color:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
24 rgba: self.split_color if self._split != 'left' else self.split_color_del if self._split_del else self.split_color_move
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
25 Rectangle:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
26 pos: self.pos
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
27 size: self.split_size, self.height
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
28 Color:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
29 rgba: self.split_color if self._split != 'top' else self.split_color_del if self._split_del else self.split_color_move
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
30 Rectangle:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
31 pos: self.x, self.y + self.height - self.split_size
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
32 size: self.width, self.split_size
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
33 # 3 dots to indicate the main split points
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
34 Color:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
35 rgba: 0, 0, 0, 1
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
36 Point:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
37 # left
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
38 points: self.x + self.sp_size, self.y + self.height / 2 - self.sp_size - self.sp_space, self.x + self.sp_size, self.y + self.height / 2, self.x + self.sp_size, self.y + self.height / 2 + self.sp_size + self.sp_space
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
39 pointsize: self.sp_size
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
40 Point:
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
41 # top
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
42 points: self.x + self.width / 2 - self.sp_size - self.sp_space, root._sp_top_y, self.x + self.width / 2, root._sp_top_y, self.x + self.width / 2 + self.sp_size + self.sp_space, root._sp_top_y
a5e8833184c6 widget handler: refactoring:
Goffi <goffi@goffi.org>
parents: 126
diff changeset
43 pointsize: self.sp_size