Mercurial > libervia-desktop-kivy
annotate cagou/plugins/plugin_wid_chat.kv @ 242:c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 03 Jan 2019 10:52:57 +0100 |
parents | ba8f3a4a5ac7 |
children | 5bd94bc08f5c |
rev | line source |
---|---|
22 | 1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client |
126 | 2 # Copyright (C) 2016-2018 Jérôme Poisson (goffi@goffi.org) |
22 | 3 |
4 # This program is free software: you can redistribute it and/or modify | |
5 # it under the terms of the GNU Affero General Public License as published by | |
6 # the Free Software Foundation, either version 3 of the License, or | |
7 # (at your option) any later version. | |
8 | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU Affero General Public License for more details. | |
13 | |
14 # You should have received a copy of the GNU Affero General Public License | |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
17 #:import TransferMenu cagou.core.menu.TransferMenu |
106
9909ed7a7a20
moved SimpleXHTMLWidget to a dedicated module
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
18 #:import SimpleXHTMLWidget cagou.core.simple_xhtml.SimpleXHTMLWidget |
104
663e44f30092
chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents:
103
diff
changeset
|
19 #:import _ sat.core.i18n._ |
116
8576d70ff803
chat: message header is hidden for info messages
Goffi <goffi@goffi.org>
parents:
106
diff
changeset
|
20 #:import C cagou.core.constants.Const |
133
c3aa71daceb8
plugin chat: use bold for nicknames in messages headers
Goffi <goffi@goffi.org>
parents:
132
diff
changeset
|
21 #:import escape kivy.utils.escape_markup |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
22 |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
23 |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
24 <MessAvatar>: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
25 size_hint: None, None |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
26 size: dp(30), dp(30) |
132
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
27 canvas.before: |
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
28 Color: |
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
29 rgba: (0.87,0.87,0.87,1) |
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
30 RoundedRectangle: |
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
31 radius: [dp(5)] |
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
32 pos: self.pos |
7ad965999d47
plugin chat: draw a background for avatars
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
33 size: self.size |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
34 |
22 | 35 <MessagesWidget>: |
45 | 36 cols: 1 |
37 padding: dp(10) | |
38 spacing: dp(5) | |
39 size_hint: 1, None | |
40 height: self.minimum_height | |
131
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
41 canvas.before: |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
42 Color: |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
43 rgba: 1, 1, 1, 1 |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
44 Rectangle: |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
45 pos: self.pos |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
46 size: self.size |
22 | 47 |
48 <MessageWidget>: | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
49 size_hint: 1, None |
138 | 50 height: right_part.minimum_height |
45 | 51 on_width: self.widthAdjust() |
47
abb81efef3bb
chat: update avatar following quick frontend improvments
Goffi <goffi@goffi.org>
parents:
45
diff
changeset
|
52 avatar: avatar |
103
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
53 delivery: delivery |
138 | 54 mess_xhtml: mess_xhtml |
45 | 55 BoxLayout: |
138 | 56 orientation: 'vertical' |
57 width: avatar.width | |
58 size_hint: None, 1 | |
45 | 59 MessAvatar: |
60 id: avatar | |
138 | 61 Widget: |
62 # use to push the avatar on the top | |
63 size_hint: 1, 1 | |
22 | 64 BoxLayout: |
138 | 65 orientation: 'vertical' |
66 id: right_part | |
67 BoxLayout: | |
68 id: header_box | |
69 size_hint: 1, None | |
70 height: time_label.height if root.mess_data.type != C.MESS_TYPE_INFO else 0 | |
71 opacity: 1 if root.mess_data.type != C.MESS_TYPE_INFO else 0 | |
72 Label: | |
73 id: time_label | |
74 color: (0, 0, 0, 1) if root.mess_data.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
|
75 font_size: root.font_size |
138 | 76 text_size: None, None |
77 size_hint: None, None | |
78 size: self.texture_size | |
79 padding: dp(5), 0 | |
80 markup: True | |
81 valign: 'middle' | |
82 text: u"[b]{}[/b], {}".format(escape(root.mess_data.nick), root.mess_data.time_text) | |
83 Label: | |
84 id: delivery | |
185
ab3f5173ef5c
chat, simple XHTML: font size adjustement
Goffi <goffi@goffi.org>
parents:
167
diff
changeset
|
85 color: 0.4, 0.4, 0.4, 1 |
ab3f5173ef5c
chat, simple XHTML: font size adjustement
Goffi <goffi@goffi.org>
parents:
167
diff
changeset
|
86 font_size: root.font_size |
138 | 87 text_size: None, None |
88 size_hint: None, None | |
89 size: self.texture_size | |
90 padding: dp(5), 0 | |
91 # XXX: DejaVuSans font is needed as check mark is not in Roboto | |
92 # this can be removed when Kivy will be able to handle fallback mechanism | |
93 # which will allow us to use fonts with more unicode characters | |
94 font_name: "DejaVuSans" | |
95 text: u'' | |
57 | 96 SimpleXHTMLWidget: |
97 id: mess_xhtml | |
138 | 98 size_hint: 1, None |
58
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
99 height: self.minimum_height |
57 | 100 xhtml: root.message_xhtml or self.escape(root.message or u' ') |
45 | 101 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) |
102 padding: root.mess_padding | |
103 bold: True if root.mess_data.type == "info" else False | |
104 | |
86 | 105 <Chat>: |
106 messages_widget: messages_widget | |
107 ScrollView: | |
108 size_hint: 1, 0.8 | |
109 scroll_y: 0 | |
110 do_scroll_x: False | |
167
ffef21fd97a2
chat: allow to scroll using side bar + increased bar size
Goffi <goffi@goffi.org>
parents:
153
diff
changeset
|
111 scroll_type: ['bars', 'content'] |
ffef21fd97a2
chat: allow to scroll using side bar + increased bar size
Goffi <goffi@goffi.org>
parents:
153
diff
changeset
|
112 bar_width: dp(6) |
86 | 113 MessagesWidget: |
114 id: messages_widget | |
115 MessageInputBox: | |
78 | 116 size_hint: 1, None |
86 | 117 height: dp(40) |
118 message_input: message_input | |
119 MessageInputWidget: | |
120 id: message_input | |
121 size_hint: 1, 1 | |
104
663e44f30092
chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents:
103
diff
changeset
|
122 hint_text: _(u"Enter your message here") |
86 | 123 on_text_validate: root.onSend(args[0]) |
153 | 124 SymbolButton |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
125 # transfer button |
153 | 126 symbol: "plus-circled" |
86 | 127 size_hint: None, 1 |
153 | 128 width: dp(30) |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
129 on_release: TransferMenu(callback=root.onTransferOK).show(self) |
117 | 130 |
233
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
131 <EncryptionMainButton>: |
117 | 132 size_hint: None, 1 |
133 width: dp(30) | |
135
091e288838e1
plugin chat: use new Symbol widget to display encryption button
Goffi <goffi@goffi.org>
parents:
133
diff
changeset
|
134 color: self.getColor() |
091e288838e1
plugin chat: use new Symbol widget to display encryption button
Goffi <goffi@goffi.org>
parents:
133
diff
changeset
|
135 symbol: self.getSymbol() |
117 | 136 |
242
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
137 <TrustManagementButton>: |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
138 symbol: "shield" |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
139 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
|
140 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
|
141 size_hint: None, 1 |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
142 width: dp(30) |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
143 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
|
144 |
233
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
145 <EncryptionButton>: |
117 | 146 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
|
147 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
|
148 height: dp(30) |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
149 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
|
150 Button: |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
151 text: root.text |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
152 size_hint: 1, 1 |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
153 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
|
154 color: 0, 0, 0, 1 |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
155 bold: True |
c2503168fab7
plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents:
233
diff
changeset
|
156 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
|
157 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
|
158 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
|
159 on_texture_size: root.best_width = self.texture_size[0] + (dp(30) if root.trust_button else 0) |
117 | 160 |
233
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
161 <EncryptionMenu>: |
117 | 162 size_hint_x: None |
233
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
163 width: self.container.minimum_width |
117 | 164 auto_width: False |
165 canvas.before: | |
166 Color: | |
167 rgba: 0, 0, 0, 1 | |
168 Rectangle: | |
169 pos: self.pos | |
170 size: self.size | |
233
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
171 # EncryptionButton: |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
172 # size_hint: 1, None |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
173 # id: start_btn |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
174 # text: _(u"Start/Refresh encrypted session") |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
175 # on_release: root.otr_start() |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
176 # EncryptionButton: |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
177 # size_hint: 1, None |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
178 # text: _(u"Finish encrypted session") |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
179 # on_release: root.otr_end() |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
180 # EncryptionButton: |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
181 # size_hint: 1, None |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
182 # text: _(u"Authenticate destinee") |
ba8f3a4a5ac7
plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents:
185
diff
changeset
|
183 # on_release: root.otr_authenticate() |