comparison cagou/plugins/plugin_wid_chat.kv @ 126:cd99f70ea592

global file reorganisation: - follow common convention by puttin cagou in "cagou" instead of "src/cagou" - added VERSION in cagou with current version - updated dates - moved main executable in /bin - moved buildozer files in root directory - temporary moved platform to assets/platform
author Goffi <goffi@goffi.org>
date Thu, 05 Apr 2018 17:11:21 +0200
parents src/cagou/plugins/plugin_wid_chat.kv@dcd6fbb3f010
children 36fc269e2a32
comparison
equal deleted inserted replaced
125:b6e6afb0dc46 126:cd99f70ea592
1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
2 # Copyright (C) 2016-2018 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 #:import TransferMenu cagou.core.menu.TransferMenu
18 #:import SimpleXHTMLWidget cagou.core.simple_xhtml.SimpleXHTMLWidget
19 #:import _ sat.core.i18n._
20 #:import C cagou.core.constants.Const
21
22
23 <MessAvatar>:
24 size_hint: None, None
25 size: dp(30), dp(30)
26
27 <MessagesWidget>:
28 cols: 1
29 padding: dp(10)
30 spacing: dp(5)
31 size_hint: 1, None
32 height: self.minimum_height
33
34 <MessageWidget>:
35 cols: 1
36 mess_xhtml: mess_xhtml
37 padding: dp(10)
38 spacing: dp(5)
39 size_hint: 1, None
40 height: self.minimum_height
41 on_width: self.widthAdjust()
42 avatar: avatar
43 delivery: delivery
44 BoxLayout:
45 id: header_box
46 size_hint: 1, None
47 height: avatar.height if root.mess_data.type != C.MESS_TYPE_INFO else 0
48 opacity: 1 if root.mess_data.type != C.MESS_TYPE_INFO else 0
49 MessAvatar:
50 id: avatar
51 Label:
52 id: time_label
53 text_size: None, None
54 size_hint: None, None
55 size: self.texture_size
56 padding: dp(5), 0
57 text: u"{}, {}".format(root.mess_data.nick, root.mess_data.time_text)
58 Label:
59 id: delivery
60 text_size: None, None
61 size_hint: None, None
62 size: self.texture_size
63 padding: dp(5), 0
64 # XXX: DejaVuSans font is needed as check mark is not in Roboto
65 # this can be removed when Kivy will be able to handle fallback mechanism
66 # which will allow us to use fonts with more unicode characters
67 font_name: "DejaVuSans"
68 text: u''
69 color: 0, 1, 0, 1
70 BoxLayout:
71 # BoxLayout is needed here, else GridLayout won't let the Label choose its width
72 size_hint: 1, None
73 height: mess_xhtml.height
74 on_size: root.widthAdjust()
75 SimpleXHTMLWidget:
76 canvas.before:
77 Color:
78 rgba: 1, 1, 1, 1
79 BorderImage:
80 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")
81 pos: self.pos
82 size: self.content_width, self.height
83 id: mess_xhtml
84 size_hint: 0.8, None
85 height: self.minimum_height
86 xhtml: root.message_xhtml or self.escape(root.message or u' ')
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
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:
100 size_hint: 1, None
101 height: dp(40)
102 message_input: message_input
103 MessageInputWidget:
104 id: message_input
105 size_hint: 1, 1
106 hint_text: _(u"Enter your message here")
107 on_text_validate: root.onSend(args[0])
108 IconButton
109 # transfer button
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))
114 on_release: TransferMenu(callback=root.onTransferOK).show(self)
115
116 <EncryptionButton>:
117 size_hint: None, 1
118 width: dp(30)
119 allow_stretch: True
120 source: self.getIconSource()
121
122 <OtrButton@Button>:
123 size_hint: None, None
124 size: self.texture_size
125 padding: dp(5), dp(10)
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()