annotate cagou/plugins/plugin_wid_chat.kv @ 276:a0835f0212d8

chat: multi-lines input: - text input is now multi-lines and grows with the text (up to a max) - on touch devices (i.e. on Android), an icon is added to the right to send the message, allowing to use virtual enter key for multi-lines messages
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:29:44 +0100
parents 7d5297984191
children 444ba439530f
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
126
cd99f70ea592 global file reorganisation:
Goffi <goffi@goffi.org>
parents: 122
diff changeset
2 # Copyright (C) 2016-2018 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
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
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 <MessagesWidget>:
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
36 cols: 1
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
37 padding: dp(10)
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
38 spacing: dp(5)
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
39 size_hint: 1, None
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
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
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
47
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
48 <MessageWidget>:
24
bc15b55a4114 chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents: 23
diff changeset
49 size_hint: 1, None
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
50 height: right_part.minimum_height
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
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
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
54 mess_xhtml: mess_xhtml
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
55 BoxLayout:
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
56 orientation: 'vertical'
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
57 width: avatar.width
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
58 size_hint: None, 1
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
59 MessAvatar:
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
60 id: avatar
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
61 Widget:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
62 # use to push the avatar on the top
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
63 size_hint: 1, 1
22
74117b733bac plugin chat: first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
64 BoxLayout:
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
65 orientation: 'vertical'
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
66 id: right_part
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
67 BoxLayout:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
68 id: header_box
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
69 size_hint: 1, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
70 height: time_label.height if root.mess_data.type != C.MESS_TYPE_INFO else 0
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
71 opacity: 1 if root.mess_data.type != C.MESS_TYPE_INFO else 0
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
72 Label:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
73 id: time_label
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
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
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
76 text_size: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
77 size_hint: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
78 size: self.texture_size
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
79 padding: dp(5), 0
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
80 markup: True
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
81 valign: 'middle'
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
82 text: u"[b]{}[/b], {}".format(escape(root.mess_data.nick), root.mess_data.time_text)
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
83 Label:
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
84 id: delivery
274
7d5297984191 core, chat: UI improvments:
Goffi <goffi@goffi.org>
parents: 252
diff changeset
85 color: C.COLOR_BTN_LIGHT
185
ab3f5173ef5c chat, simple XHTML: font size adjustement
Goffi <goffi@goffi.org>
parents: 167
diff changeset
86 font_size: root.font_size
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
87 text_size: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
88 size_hint: None, None
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
89 size: self.texture_size
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
90 padding: dp(5), 0
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
91 # 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
92 # 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
93 # which will allow us to use fonts with more unicode characters
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
94 font_name: "DejaVuSans"
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
95 text: u''
57
a51ea7874e43 chat: XHTML parsing first draft:
Goffi <goffi@goffi.org>
parents: 47
diff changeset
96 SimpleXHTMLWidget:
a51ea7874e43 chat: XHTML parsing first draft:
Goffi <goffi@goffi.org>
parents: 47
diff changeset
97 id: mess_xhtml
138
53fb221ad084 plugin chat: layout change:
Goffi <goffi@goffi.org>
parents: 136
diff changeset
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
a51ea7874e43 chat: XHTML parsing first draft:
Goffi <goffi@goffi.org>
parents: 47
diff changeset
100 xhtml: root.message_xhtml or self.escape(root.message or u' ')
45
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
101 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1)
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
102 padding: root.mess_padding
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
103 bold: True if root.mess_data.type == "info" else False
b0595a33465d chat: design improvments:
Goffi <goffi@goffi.org>
parents: 44
diff changeset
104
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
105 <Chat>:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
106 messages_widget: messages_widget
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
107 ScrollView:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
108 scroll_y: 0
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
109 do_scroll_x: False
167
ffef21fd97a2 chat: allow to scroll using side bar + increased bar size
Goffi <goffi@goffi.org>
parents: 153
diff changeset
110 scroll_type: ['bars', 'content']
ffef21fd97a2 chat: allow to scroll using side bar + increased bar size
Goffi <goffi@goffi.org>
parents: 153
diff changeset
111 bar_width: dp(6)
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
112 MessagesWidget:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
113 id: messages_widget
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
114 MessageInputBox:
78
46d962910801 chat: file upload first draft:
Goffi <goffi@goffi.org>
parents: 59
diff changeset
115 size_hint: 1, None
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
116 height: self.minimum_height
252
fdda914a298b chat: added some padding in MessageInputBox
Goffi <goffi@goffi.org>
parents: 244
diff changeset
117 spacing: dp(10)
274
7d5297984191 core, chat: UI improvments:
Goffi <goffi@goffi.org>
parents: 252
diff changeset
118 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
119 message_input: message_input
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
120 MessageInputWidget:
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
121 id: message_input
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
122 size_hint: 1, None
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
123 height: min(self.minimum_height, dp(250))
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
124 multiline: True
104
663e44f30092 chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents: 103
diff changeset
125 hint_text: _(u"Enter your message here")
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
126 on_text_validate: root.onSend(args[0])
153
e0985834f8eb chat: replaced transfer button
Goffi <goffi@goffi.org>
parents: 149
diff changeset
127 SymbolButton
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
128 # transfer button
252
fdda914a298b chat: added some padding in MessageInputBox
Goffi <goffi@goffi.org>
parents: 244
diff changeset
129 size_hint: 1, None
153
e0985834f8eb chat: replaced transfer button
Goffi <goffi@goffi.org>
parents: 149
diff changeset
130 symbol: "plus-circled"
86
c711be670ecd core, chat: upload plugin system:
Goffi <goffi@goffi.org>
parents: 78
diff changeset
131 size_hint: None, 1
153
e0985834f8eb chat: replaced transfer button
Goffi <goffi@goffi.org>
parents: 149
diff changeset
132 width: dp(30)
252
fdda914a298b chat: added some padding in MessageInputBox
Goffi <goffi@goffi.org>
parents: 244
diff changeset
133 font_size: dp(25)
97
5d2289127bb7 menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents: 86
diff changeset
134 on_release: TransferMenu(callback=root.onTransferOK).show(self)
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
135
276
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
136
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
137 <SendButton>:
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
138 # SendButton is only shown on touch devices
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
139 symbol: "forward"
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
140 size_hint: None, 1
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
141 width: dp(30)
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
142 font_size: dp(25)
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
143 on_release: self.message_input_box.send_text()
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
144
a0835f0212d8 chat: multi-lines input:
Goffi <goffi@goffi.org>
parents: 274
diff changeset
145
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
146 <EncryptionMainButton>:
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
147 size_hint: None, 1
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
148 width: dp(30)
135
091e288838e1 plugin chat: use new Symbol widget to display encryption button
Goffi <goffi@goffi.org>
parents: 133
diff changeset
149 color: self.getColor()
091e288838e1 plugin chat: use new Symbol widget to display encryption button
Goffi <goffi@goffi.org>
parents: 133
diff changeset
150 symbol: self.getSymbol()
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
151
242
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
152 <TrustManagementButton>:
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
153 symbol: "shield"
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
154 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
155 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
156 size_hint: None, 1
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
157 width: dp(30)
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
158 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
159
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
160 <EncryptionButton>:
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
161 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
162 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
163 height: dp(30)
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
164 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
165 Button:
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
166 text: root.text
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
167 size_hint: 1, 1
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
168 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
169 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
170 bold: True
c2503168fab7 plugin chat (encryption): added a button to display trust management UI.
Goffi <goffi@goffi.org>
parents: 233
diff changeset
171 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
172 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
173 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
174 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
175
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
176 <EncryptionMenu>:
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
177 size_hint_x: None
233
ba8f3a4a5ac7 plugin chat: e2e encryption improvments:
Goffi <goffi@goffi.org>
parents: 185
diff changeset
178 width: self.container.minimum_width
117
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
179 auto_width: False
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
180 canvas.before:
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
181 Color:
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
182 rgba: 0, 0, 0, 1
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
183 Rectangle:
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
184 pos: self.pos
f0291755b07c chat: OTR integration first draft:
Goffi <goffi@goffi.org>
parents: 116
diff changeset
185 size: self.size