Mercurial > libervia-desktop-kivy
annotate src/cagou/plugins/plugin_wid_chat.kv @ 104:663e44f30092
chat: added gettext call for hint_text in input
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 09 Jan 2017 00:47:03 +0100 |
parents | c601e3d40342 |
children | ce6ef88f2cff |
rev | line source |
---|---|
22 | 1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client |
2 # Copyright (C) 2016 Jérôme Poisson (goffi@goffi.org) | |
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 |
104
663e44f30092
chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents:
103
diff
changeset
|
18 #:import _ sat.core.i18n._ |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
19 |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
20 |
58
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
21 <SimpleXHTMLWidgetEscapedText>: |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
22 size_hint: None, None |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
23 size: self.texture_size |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
24 |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
25 <SimpleXHTMLWidgetText>: |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
26 size_hint: None, None |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
27 size: self.texture_size |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
28 |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
29 <SimpleXHTMLWidgetImage>: |
59 | 30 size_hint: None, None |
58
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
31 |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
32 <MessAvatar>: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
33 size_hint: None, None |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
34 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
|
35 |
22 | 36 <MessagesWidget>: |
45 | 37 cols: 1 |
38 padding: dp(10) | |
39 spacing: dp(5) | |
40 size_hint: 1, None | |
41 height: self.minimum_height | |
22 | 42 |
43 <MessageWidget>: | |
45 | 44 cols: 1 |
57 | 45 mess_xhtml: mess_xhtml |
45 | 46 padding: dp(10) |
47 spacing: dp(5) | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
48 size_hint: 1, None |
45 | 49 height: self.minimum_height |
50 on_width: self.widthAdjust() | |
47
abb81efef3bb
chat: update avatar following quick frontend improvments
Goffi <goffi@goffi.org>
parents:
45
diff
changeset
|
51 avatar: avatar |
103
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
52 delivery: delivery |
45 | 53 BoxLayout: |
54 id: header_box | |
55 size_hint: 1, None | |
56 height: avatar.height | |
57 MessAvatar: | |
58 id: avatar | |
59 source: root.mess_data.avatar | |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
60 Label: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
61 id: time_label |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
62 text_size: None, None |
45 | 63 size_hint: None, None |
64 size: self.texture_size | |
65 padding: dp(5), 0 | |
66 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
|
67 Label: |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
68 id: delivery |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
69 text_size: None, None |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
70 size_hint: None, None |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
71 size: self.texture_size |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
72 padding: dp(5), 0 |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
73 # 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
|
74 # 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
|
75 # 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
|
76 font_name: "DejaVuSans" |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
77 text: u'' |
c601e3d40342
chat: display delivery receipt (with a green check mark)
Goffi <goffi@goffi.org>
parents:
97
diff
changeset
|
78 color: 0, 1, 0, 1 |
22 | 79 BoxLayout: |
45 | 80 # BoxLayout is needed here, else GridLayout won't let the Label choose its width |
81 size_hint: 1, None | |
57 | 82 height: mess_xhtml.height |
45 | 83 on_size: root.widthAdjust() |
57 | 84 SimpleXHTMLWidget: |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
85 canvas.before: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
86 Color: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
87 rgba: 1, 1, 1, 1 |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
88 BorderImage: |
45 | 89 source: app.expand("{media}/misc/black.png") if root.mess_data.type == "info" else app.expand("{media}/misc/borders/{}.jpg", "blue" if root.mess_data.own_mess else "gray") |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
90 pos: self.pos |
58
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
91 size: self.content_width, self.height |
57 | 92 id: mess_xhtml |
58
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
93 size_hint: 0.8, None |
7aa2ffff9067
chat: <img/> tag handling first draft:
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
94 height: self.minimum_height |
57 | 95 xhtml: root.message_xhtml or self.escape(root.message or u' ') |
45 | 96 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) |
97 padding: root.mess_padding | |
98 bold: True if root.mess_data.type == "info" else False | |
99 | |
78 | 100 |
86 | 101 <Chat>: |
102 messages_widget: messages_widget | |
103 ScrollView: | |
104 size_hint: 1, 0.8 | |
105 scroll_y: 0 | |
106 do_scroll_x: False | |
107 MessagesWidget: | |
108 id: messages_widget | |
109 MessageInputBox: | |
78 | 110 size_hint: 1, None |
86 | 111 height: dp(40) |
112 message_input: message_input | |
113 MessageInputWidget: | |
114 id: message_input | |
115 size_hint: 1, 1 | |
104
663e44f30092
chat: added gettext call for hint_text in input
Goffi <goffi@goffi.org>
parents:
103
diff
changeset
|
116 hint_text: _(u"Enter your message here") |
86 | 117 on_text_validate: root.onSend(args[0]) |
118 IconButton | |
97
5d2289127bb7
menu (upload): better menu using dedicated widget:
Goffi <goffi@goffi.org>
parents:
86
diff
changeset
|
119 # transfer button |
86 | 120 source: app.expand("{media}/icons/tango/actions/32/list-add.png") |
121 allow_stretch: True | |
122 size_hint: None, 1 | |
123 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
|
124 on_release: TransferMenu(callback=root.onTransferOK).show(self) |