Mercurial > libervia-desktop-kivy
annotate src/cagou/plugins/plugin_wid_chat.kv @ 45:b0595a33465d
chat: design improvments:
- all message are now on the same side, no more left/right which can be difficult to read on big screen
- use of GridLayout for MessageWidget and MessagesWidget, as the minimum_height attribute simplify size handling. This attribute will be present in BoxLayout too in Kivy 1.9.2, so we may switch back in the future
- info messages are displayed in yellow with a black background
- nick and date are now displayed in the same label
- avatar, nick and date are on the same line just above the message bubble
- padding/spacing adjustments
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 04 Sep 2016 19:38:21 +0200 |
parents | 7819e9efa250 |
children | abb81efef3bb |
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 | |
44
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
17 |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
18 <MessAvatar>: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
19 size_hint: None, None |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
20 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
|
21 |
22 | 22 <MessagesWidget>: |
45 | 23 cols: 1 |
24 padding: dp(10) | |
25 spacing: dp(5) | |
26 size_hint: 1, None | |
27 height: self.minimum_height | |
22 | 28 |
29 <MessageWidget>: | |
45 | 30 cols: 1 |
22 | 31 mess_label: mess_label |
45 | 32 padding: dp(10) |
33 spacing: dp(5) | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
34 size_hint: 1, None |
45 | 35 height: self.minimum_height |
36 on_width: self.widthAdjust() | |
37 BoxLayout: | |
38 id: header_box | |
39 size_hint: 1, None | |
40 height: avatar.height | |
41 MessAvatar: | |
42 id: avatar | |
43 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
|
44 Label: |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
45 id: time_label |
7819e9efa250
chat: avatar and nick are now displayed, need further aesthetic improvments
Goffi <goffi@goffi.org>
parents:
31
diff
changeset
|
46 text_size: None, None |
45 | 47 size_hint: None, None |
48 size: self.texture_size | |
49 padding: dp(5), 0 | |
50 text: u"{}, {}".format(root.mess_data.nick, root.mess_data.time_text) | |
22 | 51 BoxLayout: |
45 | 52 # BoxLayout is needed here, else GridLayout won't let the Label choose its width |
53 size_hint: 1, None | |
54 height: mess_label.height | |
55 on_size: root.widthAdjust() | |
22 | 56 Label: |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
57 canvas.before: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
58 Color: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
59 rgba: 1, 1, 1, 1 |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
60 BorderImage: |
45 | 61 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
|
62 pos: self.pos |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
63 size: self.size |
22 | 64 id: mess_label |
45 | 65 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) |
66 padding: root.mess_padding | |
22 | 67 text_size: None, None |
68 size_hint: None, None | |
69 size: self.texture_size | |
45 | 70 bold: True if root.mess_data.type == "info" else False |
22 | 71 text: root.message or u' ' |
45 | 72 # on_texture_size: root.widthAdjust() |
73 | |
74 | |
75 <MessageInputWidget>: | |
76 size_hint: 1, None | |
77 height: dp(40) | |
78 hint_text: "Enter your message here" |