annotate cagou/plugins/plugin_wid_contact_list.kv @ 412:7c6149c249c1

chat: attachment sending: - files to send are not sent directly anymore, but added to attachment, and linked to the message when it is sent, this is more user friendly and avoid the accidental sending of wrong file - user can remove the attachment before sending the message, using the "close" symbol - new "Chat.addAtachment" method - upload progress is shown on the AttachmentItem thanks to the "progress" property - AttachmentItem stays in the attachments layout until uploaded or an error happens. Messages can still be sent while the item is being uploaded.
author Goffi <goffi@goffi.org>
date Sun, 23 Feb 2020 15:39:03 +0100
parents e2b51663d8b8
children 3e2333a11f61
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
7b0a53d2afd3 contact list: 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: 255
diff changeset
2 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
9
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
3
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This program is free software: you can redistribute it and/or modify
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # it under the terms of the GNU Affero General Public License as published by
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # the Free Software Foundation, either version 3 of the License, or
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # (at your option) any later version.
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
8
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # GNU Affero General Public License for more details.
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
13
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # You should have received a copy of the GNU Affero General Public License
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7b0a53d2afd3 contact list: first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
16
219
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
17 #:import _ sat.core.i18n._
223
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
18 #:import e kivy.utils.escape_markup
50
c45d6e9ec731 contact list: fixed contact list display
Goffi <goffi@goffi.org>
parents: 15
diff changeset
19
221
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
20 <AddContactMenu>:
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
21 padding: dp(20)
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
22 spacing: dp(10)
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
23 Label:
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
24 size_hint: 1, None
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
25 color: 1, 1, 1, 1
223
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
26 text: _("Please enter new contact JID")
221
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
27 text_size: root.width, None
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
28 size: self.texture_size
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
29 halign: "center"
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
30 bold: True
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
31 TextInput:
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
32 id: contact_jid
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
33 size_hint: 1, None
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
34 height: sp(30)
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
35 hint_text: _("enter here your new contact JID")
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
36 Button:
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
37 size_hint: 1, None
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
38 height: sp(50)
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
39 text: _("add this contact")
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
40 on_release: root.addContact(contact_jid.text)
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
41 Widget:
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
42
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
43
223
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
44 <DelContactMenu>:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
45 padding: dp(20)
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
46 spacing: dp(10)
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
47 Avatar:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
48 id: avatar
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
49 size_hint: 1, None
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
50 height: dp(60)
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
51 source: root.contact_item.data.get('avatar', app.default_avatar)
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
52 allow_stretch: True
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
53 Label:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
54 size_hint: 1, None
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
55 color: 1, 1, 1, 1
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
56 text: _("Are you sure you wand to remove [b]{name}[/b] from your contact list?").format(name=e(root.contact_item.jid))
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
57 markup: True
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
58 text_size: root.width, None
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
59 size: self.texture_size
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
60 halign: "center"
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
61 BoxLayout:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
62 Button:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
63 background_color: 1, 0, 0, 1
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
64 size_hint: 0.5, None
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
65 height: sp(50)
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
66 text: _("yes, remove it")
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
67 bold: True
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
68 on_release: root.do_delete_contact()
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
69 Button:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
70 size_hint: 0.5, None
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
71 height: sp(50)
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
72 text: _("no, keep it")
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
73 on_release: root.hide()
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
74 Widget:
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
75
9e5f9f0cee48 plugin contact list: use new TouchMenuBehaviour to implement contact deletion
Goffi <goffi@goffi.org>
parents: 221
diff changeset
76
219
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
77 <ContactList>:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
78 float_layout: float_layout
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
79 layout: layout
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
80 orientation: 'vertical'
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
81 BoxLayout:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
82 size_hint: 1, None
255
03d74435c01c contact: fixed add contact button size
Goffi <goffi@goffi.org>
parents: 223
diff changeset
83 height: dp(35)
03d74435c01c contact: fixed add contact button size
Goffi <goffi@goffi.org>
parents: 223
diff changeset
84 width: dp(35)
03d74435c01c contact: fixed add contact button size
Goffi <goffi@goffi.org>
parents: 223
diff changeset
85 font_size: dp(30)
219
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
86 Widget:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
87 SymbolLabel:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
88 symbol: 'plus-circled'
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
89 text: _("add a contact")
221
e1a385a791cc plugin contact list: implemented contact addition
Goffi <goffi@goffi.org>
parents: 219
diff changeset
90 on_release: root.addContactMenu()
219
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
91 Widget:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
92 FloatLayout:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
93 id: float_layout
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
94 ScrollView:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
95 size_hint: 1, 1
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
96 pos_hint: {'x': 0, 'y': 0}
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
97 do_scroll_x: False
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
98 scroll_type: ['bars', 'content']
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
99 bar_width: dp(6)
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
100 StackLayout:
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
101 id: layout
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
102 size_hint: 1, None
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
103 height: self.minimum_height
9faccd140119 plugin contact list: refactoring:
Goffi <goffi@goffi.org>
parents: 157
diff changeset
104 spacing: 0