Mercurial > libervia-desktop-kivy
annotate src/cagou/plugins/plugin_wid_chat.kv @ 29:8b5827c43155
notes first draft:
Implementation of XMLUI notes. There is a new header on top of root widget which display notifications, and notes are shown for a couple of seconds.
A blue Cagou head appear when there are notes, and user can display 10 last when clicking on it.
This header will probably not be present on platforms such as Android, because there is already a system-wide notifications handler which can be used instead (saving visual space).
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 21 Aug 2016 15:15:25 +0200 |
parents | bc15b55a4114 |
children | 8ea3f335307d |
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 | |
17 <MessagesWidget>: | |
18 spacing: self._spacing | |
19 padding: self._padding | |
20 | |
21 <MessageInputWidget>: | |
22 size_hint: 1,None | |
23 height: 40 | |
24 hint_text: "Enter your message here" | |
25 | |
26 <MessageWidget>: | |
27 mess_label: mess_label | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
28 size_hint: 1, None |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
29 height: time_label.height + mess_label.height |
22 | 30 on_height: if root.parent: root.parent.sizeAdjust() |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
31 on_width: self.sizeAdjust() |
23
f9869f34f629
chat: time text is now displayed above text bubble
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
32 Label: |
f9869f34f629
chat: time text is now displayed above text bubble
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
33 id: time_label |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
34 text_size: None, None |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
35 size_hint: 1, None |
23
f9869f34f629
chat: time text is now displayed above text bubble
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
36 height: self.texture_size[1] |
f9869f34f629
chat: time text is now displayed above text bubble
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
37 text: root.mess_data.time_text |
f9869f34f629
chat: time text is now displayed above text bubble
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
38 halign: "center" |
22 | 39 BoxLayout: |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
40 size_hint: None,None |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
41 size: mess_label.size |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
42 pos_hint: {'x': 0} if root.mess_data.own_mess else {'right': 1} |
23
f9869f34f629
chat: time text is now displayed above text bubble
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
43 |
22 | 44 # Label: |
45 # id: nick_label | |
46 # text: root.mess_data.nick | |
47 # # text: unicode(self.texture_size) | |
48 # padding: 5, 5 | |
49 # bold: True | |
50 # # text_size: None, self.height | |
51 # # height: 20 | |
52 # size_hint: None, None | |
53 # size: self.texture_size | |
54 # pos_hint: {'top': 0} | |
55 # # width: self.texture_size[0] | |
56 # # height: max(self.texture_size[1], mess_label.height) | |
57 # # size_hint: None, 1 | |
58 # # valign: "top" | |
59 Label: | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
60 canvas.before: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
61 Color: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
62 rgba: 1, 1, 1, 1 |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
63 BorderImage: |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
64 source: "cagou/images/border_{}.jpg".format("blue" if root.mess_data.own_mess else "gray") |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
65 pos: self.pos |
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
66 size: self.size |
22 | 67 id: mess_label |
68 color: 0, 0, 0, 1 | |
69 padding: 5, 5 | |
70 text_size: None, None | |
71 size_hint: None, None | |
72 size: self.texture_size | |
73 text: root.message or u' ' | |
24
bc15b55a4114
chat: better bubble and time resizing
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
74 on_texture_size: root.sizeAdjust() |