Mercurial > libervia-desktop-kivy
annotate cagou/plugins/plugin_wid_chat.kv @ 131:36fc269e2a32
core: changed default background color to white
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Apr 2018 16:12:58 +0200 |
parents | cd99f70ea592 |
children | 7ad965999d47 |
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 |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
21 |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
22 |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
23 <MessAvatar>: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
24 size_hint: None, None |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
25 size: dp(30), dp(30) |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
26 |
22 | 27 <MessagesWidget>: |
45 | 28 cols: 1 |
29 padding: dp(10) | |
30 spacing: dp(5) | |
31 size_hint: 1, None | |
32 height: self.minimum_height | |
131
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
33 canvas.before: |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
34 Color: |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
35 rgba: 1, 1, 1, 1 |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
36 Rectangle: |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
37 pos: self.pos |
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
38 size: self.size |
22 | 39 |
40 <MessageWidget>: | |
45 | 41 cols: 1 |
57 | 42 mess_xhtml: mess_xhtml |
45 | 43 padding: dp(10) |
44 spacing: dp(5) | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
45 size_hint: 1, None |
45 | 46 height: self.minimum_height |
47 on_width: self.widthAdjust() | |
47
abb81efef3bb
chat: update avatar following quick frontend improvments
Goffi <goffi@goffi.org>
parents:
45
diff
changeset
|
48 avatar: avatar |
103
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
49 delivery: delivery |
45 | 50 BoxLayout: |
51 id: header_box | |
52 size_hint: 1, None | |
116
8576d70ff803
chat: message header is hidden for info messages
Goffi <goffi@goffi.org>
parents:
106
diff
changeset
|
53 height: avatar.height if root.mess_data.type != C.MESS_TYPE_INFO else 0 |
8576d70ff803
chat: message header is hidden for info messages
Goffi <goffi@goffi.org>
parents:
106
diff
changeset
|
54 opacity: 1 if root.mess_data.type != C.MESS_TYPE_INFO else 0 |
45 | 55 MessAvatar: |
56 id: avatar | |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
57 Label: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
58 id: time_label |
131
36fc269e2a32
core: changed default background color to white
Goffi <goffi@goffi.org>
parents:
126
diff
changeset
|
59 color: (0, 0, 0, 1) if root.mess_data.own_mess else (0.55,0.55,0.55,1) |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
60 text_size: None, None |
45 | 61 size_hint: None, None |
62 size: self.texture_size | |
63 padding: dp(5), 0 | |
64 text: u"{}, {}".format(root.mess_data.nick, root.mess_data.time_text) | |
103
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
65 Label: |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
66 id: delivery |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
67 text_size: None, None |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
68 size_hint: None, None |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
69 size: self.texture_size |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
70 padding: dp(5), 0 |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
71 # XXX: DejaVuSans font is needed as check mark is not in Roboto |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
72 # this can be removed when Kivy will be able to handle fallback mechanism |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
73 # which will allow us to use fonts with more unicode characters |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
74 font_name: "DejaVuSans" |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
75 text: u'' |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
76 color: 0, 1, 0, 1 |
22 | 77 BoxLayout: |
45 | 78 # BoxLayout is needed here, else GridLayout won't let the Label choose its width |
79 size_hint: 1, None | |
57 | 80 height: mess_xhtml.height |
45 | 81 on_size: root.widthAdjust() |
57 | 82 SimpleXHTMLWidget: |
83 id: mess_xhtml | |
58
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
84 size_hint: 0.8, None |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
85 height: self.minimum_height |
57 | 86 xhtml: root.message_xhtml or self.escape(root.message or u' ') |
45 | 87 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) |
88 padding: root.mess_padding | |
89 bold: True if root.mess_data.type == "info" else False | |
90 | |
86 | 91 <Chat>: |
92 messages_widget: messages_widget | |
93 ScrollView: | |
94 size_hint: 1, 0.8 | |
95 scroll_y: 0 | |
96 do_scroll_x: False | |
97 MessagesWidget: | |
98 id: messages_widget | |
99 MessageInputBox: | |
78 | 100 size_hint: 1, None |
86 | 101 height: dp(40) |
102 message_input: message_input | |
103 MessageInputWidget: | |
104 id: message_input | |
105 size_hint: 1, 1 | |
104
663e44f30092
chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents:
103
diff
changeset
|
106 hint_text: _(u"Enter your message here") |
86 | 107 on_text_validate: root.onSend(args[0]) |
108 IconButton | |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
109 # transfer button |
86 | 110 source: app.expand("{media}/icons/tango/actions/32/list-add.png") |
111 allow_stretch: True | |
112 size_hint: None, 1 | |
113 width: max(self.texture_size[0], dp(40)) | |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
114 on_release: TransferMenu(callback=root.onTransferOK).show(self) |
117 | 115 |
116 <EncryptionButton>: | |
117 size_hint: None, 1 | |
118 width: dp(30) | |
122
dcd6fbb3f010
chat: handle new OTR state signal and change encryption icon consequently
Goffi <goffi@goffi.org>
parents:
117
diff
changeset
|
119 allow_stretch: True |
dcd6fbb3f010
chat: handle new OTR state signal and change encryption icon consequently
Goffi <goffi@goffi.org>
parents:
117
diff
changeset
|
120 source: self.getIconSource() |
117 | 121 |
122 <OtrButton@Button>: | |
123 size_hint: None, None | |
124 size: self.texture_size | |
122
dcd6fbb3f010
chat: handle new OTR state signal and change encryption icon consequently
Goffi <goffi@goffi.org>
parents:
117
diff
changeset
|
125 padding: dp(5), dp(10) |
117 | 126 |
127 <OtrMenu>: | |
128 size_hint_x: None | |
129 width: start_btn.width | |
130 auto_width: False | |
131 canvas.before: | |
132 Color: | |
133 rgba: 0, 0, 0, 1 | |
134 Rectangle: | |
135 pos: self.pos | |
136 size: self.size | |
137 OtrButton: | |
138 id: start_btn | |
139 text: _(u"Start/Refresh encrypted session") | |
140 on_release: root.otr_start() | |
141 OtrButton: | |
142 text: _(u"Finish encrypted session") | |
143 on_release: root.otr_end() | |
144 OtrButton: | |
145 text: _(u"Authenticate destinee") | |
146 on_release: root.otr_authenticate() |