annotate cagou/plugins/plugin_wid_chat.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 b018386653c2
children c466678c57b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
74117b733bac plugin chat: 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: 278
diff changeset
2 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
22
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This program is free software: you can redistribute it and/or modify
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # it under the terms of the GNU Affero General Public License as published by
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # the Free Software Foundation, either version 3 of the License, or
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # (at your option) any later version.
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # GNU Affero General Public License for more details.
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # You should have received a copy of the GNU Affero General Public License
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
104
663e44f30092 chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents: 103
diff changeset
17 #:import _ sat.core.i18n._
116
8576d70ff803 chat: message header is hidden for info messages
Goffi <goffi@goffi.org>
parents: 106
diff changeset
18 #:import C cagou.core.constants.Const
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
19 #:import G cagou.G
133
c3aa71daceb8 plugin chat: use bold for nicknames in messages headers
Goffi <goffi@goffi.org>
parents: 132
diff changeset
20 #:import escape kivy.utils.escape_markup
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
21 #:import SimpleXHTMLWidget cagou.core.simple_xhtml.SimpleXHTMLWidget
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
22 #:import DelayedBoxLayout cagou.core.common_widgets.DelayedBoxLayout
326
d9d2b56f46db plugin chat: infinite scroll:
Goffi <goffi@goffi.org>
parents: 325
diff changeset
23 #:import ScrollEffect kivy.effects.scroll.ScrollEffect
394
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
24 #:import CategorySeparator cagou.core.common_widgets.CategorySeparator
354
aa860c10acfc chat: new chat selector:
Goffi <goffi@goffi.org>
parents: 326
diff changeset
25
aa860c10acfc chat: new chat selector:
Goffi <goffi@goffi.org>
parents: 326
diff changeset
26
aa860c10acfc chat: new chat selector:
Goffi <goffi@goffi.org>
parents: 326
diff changeset
27 # Chat
aa860c10acfc chat: new chat selector:
Goffi <goffi@goffi.org>
parents: 326
diff changeset
28
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
29
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
30 <AttachmentItem>:
411
b018386653c2 chat: work around ScrollView bug in attachments by using a StackLayout instead:
Goffi <goffi@goffi.org>
parents: 409
diff changeset
31 size_hint: None, None
b018386653c2 chat: work around ScrollView bug in attachments by using a StackLayout instead:
Goffi <goffi@goffi.org>
parents: 409
diff changeset
32 size: self.minimum_width, dp(50)
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
33 canvas.before:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
34 Color:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
35 rgb: app.c_prim_dark
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
36 RoundedRectangle:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
37 pos: self.pos
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
38 size: self.size
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
39 Color:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
40 rgb: 1, 1, 1, 1
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
41 RoundedRectangle:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
42 pos: self.x + dp(1), self.y + dp(1)
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
43 size: self.width - dp(2), self.height - dp(2)
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
44 Color:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
45 rgb: app.c_sec_light
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
46 RoundedRectangle:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
47 pos: self.x + dp(1), self.y + dp(1)
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
48 size: (self.width - dp(2)) * root.progress / 100, self.height - dp(2)
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
49 SymbolLabel:
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
50 symbol: root.get_symbol(root.data)
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
51 color: 0, 0, 0, 1
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
52 text: root.data.get('name', _('unnamed'))
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
53 bold: False
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
54 on_press: root.on_press()
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
55
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
56
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
57 <AttachmentsLayout>:
411
b018386653c2 chat: work around ScrollView bug in attachments by using a StackLayout instead:
Goffi <goffi@goffi.org>
parents: 409
diff changeset
58 attachments: self
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
59 size_hint: 1, None
411
b018386653c2 chat: work around ScrollView bug in attachments by using a StackLayout instead:
Goffi <goffi@goffi.org>
parents: 409
diff changeset
60 height: self.minimum_height
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
61 spacing: dp(5)
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
62
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
63
44
7819e9efa250 chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents: 31
diff changeset
64 <MessAvatar>:
7819e9efa250 chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents: 31
diff changeset
65 size_hint: None, None
7819e9efa250 chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents: 31
diff changeset
66 size: dp(30), dp(30)
132
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
67 canvas.before:
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
68 Color:
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
69 rgba: (0.87,0.87,0.87,1)
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
70 RoundedRectangle:
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
71 radius: [dp(5)]
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
72 pos: self.pos
7ad965999d47 plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents: 131
diff changeset
73 size: self.size
44
7819e9efa250 chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents: 31
diff changeset
74
22
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
75
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
76 <MessageWidget>:
24
bc15b55a4114 chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents: 23
diff changeset
77 size_hint: 1, None
47
abb81efef3bb chat: update avatar following quick frontend improvments
Goffi <goffi@goffi.org>
parents: 45
diff changeset
78 avatar: avatar
103
c601e3d40342 chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents: 97
diff changeset
79 delivery: delivery
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
80 mess_xhtml: mess_xhtml
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
81 right_part: right_part
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
82 header_box: header_box
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
83 height: self.minimum_height
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
84 BoxLayout:
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
85 orientation: 'vertical'
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
86 width: avatar.width
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
87 size_hint: None, 1
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
88 MessAvatar:
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
89 id: avatar
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
90 source: (root.mess_data.avatar or '') if root.mess_data else ''
367
abb57182ebfb chat: prepend nick to message input when occupant avatar is touched on group chat.
Goffi <goffi@goffi.org>
parents: 354
diff changeset
91 on_press: root.chat.addNick(root.nick)
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
92 Widget:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
93 # use to push the avatar on the top
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
94 size_hint: 1, 1
22
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
95 BoxLayout:
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
96 size_hint: 1, None
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
97 orientation: 'vertical'
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
98 id: right_part
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
99 height: self.minimum_height
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
100 BoxLayout:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
101 id: header_box
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
102 size_hint: 1, None
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
103 height: time_label.height if root.mess_type != C.MESS_TYPE_INFO else 0
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
104 opacity: 1 if root.mess_type != C.MESS_TYPE_INFO else 0
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
105 Label:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
106 id: time_label
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
107 color: (0, 0, 0, 1) if root.own_mess else (0.55,0.55,0.55,1)
185
ab3f5173ef5c chat, simple XHTML: font size adjustement
Goffi <goffi@goffi.org>
parents: 167
diff changeset
108 font_size: root.font_size
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
109 text_size: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
110 size_hint: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
111 size: self.texture_size
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
112 padding: dp(5), 0
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
113 markup: True
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
114 valign: 'middle'
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
115 text: u"[b]{}[/b], {}".format(escape(root.nick), root.time_text)
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
116 Label:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
117 id: delivery
274
7d5297984191 core, chat: UI improvments:
Goffi <goffi@goffi.org>
parents: 252
diff changeset
118 color: C.COLOR_BTN_LIGHT
185
ab3f5173ef5c chat, simple XHTML: font size adjustement
Goffi <goffi@goffi.org>
parents: 167
diff changeset
119 font_size: root.font_size
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
120 text_size: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
121 size_hint: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
122 size: self.texture_size
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
123 padding: dp(5), 0
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
124 # XXX: DejaVuSans font is needed as check mark is not in Roboto
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
125 # this can be removed when Kivy will be able to handle fallback mechanism
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
126 # which will allow us to use fonts with more unicode characters
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
127 font_name: "DejaVuSans"
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
128 text: u''
57
a51ea7874e43 chat: XHTML parsing first draft:
Goffi <goffi@goffi.org>
parents: 47
diff changeset
129 SimpleXHTMLWidget:
a51ea7874e43 chat: XHTML parsing first draft:
Goffi <goffi@goffi.org>
parents: 47
diff changeset
130 id: mess_xhtml
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
131 size_hint: 1, None
58
7aa2ffff9067 chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents: 57
diff changeset
132 height: self.minimum_height
409
2caea63ae2ab chat: show attachments as clickable icons
Goffi <goffi@goffi.org>
parents: 406
diff changeset
133 xhtml: root.message_xhtml or self.escape(root.message or u'')
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
134 color: (0.74,0.74,0.24,1) if root.mess_type == "info" else (0, 0, 0, 1)
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
135 padding: root.mess_padding
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
136 bold: True if root.mess_type == "info" else False
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
137
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
138
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
139 <AttachmentToSendItem>:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
140 SymbolButton:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
141 opacity: 0 if root.sending else 1
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
142 size_hint: None, 1
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
143 symbol: "cancel-circled"
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
144 on_press: root.parent.remove_widget(root)
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
145
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
146
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
147 <AttachmentsToSend>:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
148 attachments: attachments_layout.attachments
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
149 orientation: "vertical"
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
150 size_hint: 1, None
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
151 height: self.minimum_height if self.attachments.children else 0
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
152 opacity: 1 if self.attachments.children else 0
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
153 padding: [app.MARGIN_LEFT, dp(5), app.MARGIN_RIGHT, dp(5)]
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
154 Label:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
155 size_hint: 1, None
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
156 size: self.texture_size
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
157 text: _("attachments:")
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
158 bold: True
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
159 AttachmentsLayout:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
160 id: attachments_layout
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
161 canvas.before:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
162 Color:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
163 rgba: app.c_prim
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
164 Rectangle:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
165 pos: self.pos
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
166 size: self.size
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
167
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
168
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
169 <Chat>:
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
170 attachments_to_send: attachments_to_send
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
171 message_input: message_input
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
172 messages_widget: messages_widget
326
d9d2b56f46db plugin chat: infinite scroll:
Goffi <goffi@goffi.org>
parents: 325
diff changeset
173 history_scroll: history_scroll
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
174 ScrollView:
326
d9d2b56f46db plugin chat: infinite scroll:
Goffi <goffi@goffi.org>
parents: 325
diff changeset
175 id: history_scroll
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
176 scroll_y: 0
326
d9d2b56f46db plugin chat: infinite scroll:
Goffi <goffi@goffi.org>
parents: 325
diff changeset
177 on_scroll_y: root.onScroll(*args)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
178 do_scroll_x: False
167
ffef21fd97a2 chat: allow to scroll using side bar + increased bar size
Goffi <goffi@goffi.org>
parents: 153
diff changeset
179 scroll_type: ['bars', 'content']
326
d9d2b56f46db plugin chat: infinite scroll:
Goffi <goffi@goffi.org>
parents: 325
diff changeset
180 bar_width: dp(10)
d9d2b56f46db plugin chat: infinite scroll:
Goffi <goffi@goffi.org>
parents: 325
diff changeset
181 effect_cls: ScrollEffect
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
182 DelayedBoxLayout:
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
183 id: messages_widget
325
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
184 size_hint_y: None
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
185 padding: [app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, dp(10)]
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
186 spacing: dp(10)
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
187 height: self.minimum_height
5868a5575e01 chat: cleaning + some improvments:
Goffi <goffi@goffi.org>
parents: 322
diff changeset
188 orientation: 'vertical'
412
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
189 AttachmentsToSend:
7c6149c249c1 chat: attachment sending:
Goffi <goffi@goffi.org>
parents: 411
diff changeset
190 id: attachments_to_send
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
191 MessageInputBox:
78
46d962910801 chat: file upload first draft:
Goffi <goffi@goffi.org>
parents: 59
diff changeset
192 size_hint: 1, None
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
193 height: self.minimum_height
252
fdda914a298b chat: added some padding in MessageInputBox
Goffi <goffi@goffi.org>
parents: 244
diff changeset
194 spacing: dp(10)
274
7d5297984191 core, chat: UI improvments:
Goffi <goffi@goffi.org>
parents: 252
diff changeset
195 padding: [app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, dp(10)]
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
196 message_input: message_input
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
197 MessageInputWidget:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
198 id: message_input
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
199 size_hint: 1, None
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
200 height: min(self.minimum_height, dp(250))
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
201 multiline: True
104
663e44f30092 chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents: 103
diff changeset
202 hint_text: _(u"Enter your message here")
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
203 on_text_validate: root.onSend(args[0])
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
204
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
205
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
206 <SendButton>:
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
207 # SendButton is only shown on touch devices
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
208 symbol: "forward"
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
209 size_hint: None, 1
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
210 width: dp(30)
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
211 font_size: dp(25)
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
212 on_release: self.message_input_box.send_text()
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
213
278
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
214 # Buttons added in header
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
215
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
216 <TransferButton>:
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
217 size_hint: None, 1
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
218 symbol: "plus-circled"
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
219 width: dp(30)
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
220 font_size: dp(25)
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
221 color: 0.4, 0.4, 0.4, 1
444ba439530f chat: moved transfer button to header_box
Goffi <goffi@goffi.org>
parents: 276
diff changeset
222
287
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
223 <MenuButton@Button>
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
224 size_hint_y: None
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
225 height: dp(30)
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
226 on_texture_size: self.parent.parent.width = max(self.parent.parent.width, self.texture_size[0] + dp(10))
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
227
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
228 <ExtraMenu>:
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
229 auto_width: False
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
230 MenuButton:
393
e2f806779b53 chat: added a "close" item in menu, to leave MUC/close current chat widget.
Goffi <goffi@goffi.org>
parents: 367
diff changeset
231 text: _("bookmarks")
287
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
232 on_release: root.select("bookmark")
393
e2f806779b53 chat: added a "close" item in menu, to leave MUC/close current chat widget.
Goffi <goffi@goffi.org>
parents: 367
diff changeset
233 MenuButton:
e2f806779b53 chat: added a "close" item in menu, to leave MUC/close current chat widget.
Goffi <goffi@goffi.org>
parents: 367
diff changeset
234 text: _("close")
e2f806779b53 chat: added a "close" item in menu, to leave MUC/close current chat widget.
Goffi <goffi@goffi.org>
parents: 367
diff changeset
235 on_release: root.select("close")
287
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
236
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
237 <ExtraButton>:
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
238 size_hint: None, 1
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
239 symbol: "dot-3-vert"
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
240 width: dp(30)
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
241 font_size: dp(25)
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
242 color: 0.4, 0.4, 0.4, 1
5d96bcd3bfec chat: added an extra menu (3 dots menu):
Goffi <goffi@goffi.org>
parents: 282
diff changeset
243 on_release: self.chat.extra_menu.open(self)
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
244
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
245 <EncryptionMainButton>:
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
246 size_hint: None, 1
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
247 width: dp(30)
135
091e288838e1 plugin chat: use new Symbol widget to display encryption button
Goffi <goffi@goffi.org>
parents: 133
diff changeset
248 color: self.getColor()
091e288838e1 plugin chat: use new Symbol widget to display encryption button
Goffi <goffi@goffi.org>
parents: 133
diff changeset
249 symbol: self.getSymbol()
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
250
242
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
251 <TrustManagementButton>:
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
252 symbol: "shield"
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
253 padding: dp(5), dp(10)
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
254 bg_color: app.c_prim_dark
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
255 size_hint: None, 1
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
256 width: dp(30)
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
257 on_release: self.parent.dispatch("on_trust_release")
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
258
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
259 <EncryptionButton>:
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
260 size_hint: None, None
242
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
261 width: self.parent.parent.best_width if self.parent is not None else 30
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
262 height: dp(30)
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
263 on_best_width: self.parent.parent.best_width = max(self.parent.parent.best_width, args[1])
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
264 Button:
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
265 text: root.text
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
266 size_hint: 1, 1
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
267 padding: dp(5), dp(10)
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
268 color: 0, 0, 0, 1
312
772c170b47a9 Python3 port:
Goffi <goffi@goffi.org>
parents: 301
diff changeset
269 bold: root.bold
242
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
270 background_normal: app.expand('{media}/misc/borders/border_filled_black.png')
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
271 background_color: app.c_sec if root.selected else app.c_prim_dark
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
272 on_release: root.dispatch("on_release")
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
273 on_texture_size: root.best_width = self.texture_size[0] + (dp(30) if root.trust_button else 0)
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
274
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
275 <EncryptionMenu>:
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
276 size_hint_x: None
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
277 width: self.container.minimum_width
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
278 auto_width: False
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
279 canvas.before:
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
280 Color:
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
281 rgba: 0, 0, 0, 1
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
282 Rectangle:
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
283 pos: self.pos
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
284 size: self.size
394
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
285
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
286
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
287 # Chat Selector
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
288
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
289 <ChatSelector>:
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
290 jid_selector: jid_selector
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
291 JidSelector:
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
292 id: jid_selector
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
293 on_select: root.on_select(args[1])
404
f7476818f9fb core (common): JidSelector + behaviors various improvments:
Goffi <goffi@goffi.org>
parents: 394
diff changeset
294 to_show: ["opened_chats", "roster", "bookmarks"]
394
d15828ca9d86 chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector:
Goffi <goffi@goffi.org>
parents: 393
diff changeset
295