comparison src/cagou/plugins/plugin_wid_chat.kv @ 22:74117b733bac

plugin chat: first draft: - only one 2 one display is handled for now - own messages are displayed in blue, other ones in gray - by default we display our own jid (for now) - to change target, contact in contact widget can be clicked, or a jid can be entered in header input - disco is called on jid entered in header, if it's a conference a MUCJoin will be called (not implemented yet), else a new chat widget with the jid replace the current one
author Goffi <goffi@goffi.org>
date Mon, 08 Aug 2016 01:07:43 +0200
parents
children f9869f34f629
comparison
equal deleted inserted replaced
21:57bf68eacdb9 22:74117b733bac
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 canvas.before:
28 Color:
29 rgba: 1, 1, 1, 1
30 BorderImage:
31 source: "cagou/images/border_{}.jpg".format("blue" if root.mess_data.own_mess else "gray")
32 pos: self.pos
33 size: self.size
34
35 mess_label: mess_label
36 size_hint: None,None
37 pos_hint: {'x': 0} if root.mess_data.own_mess else {'right': 1}
38 height: max(mess_label.height, 20)
39 width: mess_label.width
40 on_height: if root.parent: root.parent.sizeAdjust()
41 BoxLayout:
42 # Label:
43 # id: nick_label
44 # text: root.mess_data.nick
45 # # text: unicode(self.texture_size)
46 # padding: 5, 5
47 # bold: True
48 # # text_size: None, self.height
49 # # height: 20
50 # size_hint: None, None
51 # size: self.texture_size
52 # pos_hint: {'top': 0}
53 # # width: self.texture_size[0]
54 # # height: max(self.texture_size[1], mess_label.height)
55 # # size_hint: None, 1
56 # # valign: "top"
57 Label:
58 id: mess_label
59 color: 0, 0, 0, 1
60 padding: 5, 5
61 text_size: None, None
62 size_hint: None, None
63 size: self.texture_size
64 # text: 'root:{} nick:{} self:{}'.format(root.height, nick_label.height, self.height)
65 text: root.message or u' '
66 # haligh: "left"
67 on_texture_size: root.adjustMax(self.texture_size)