comparison src/cagou/plugins/plugin_wid_chat.kv @ 24:bc15b55a4114

chat: better bubble and time resizing
author Goffi <goffi@goffi.org>
date Tue, 09 Aug 2016 22:06:00 +0200
parents f9869f34f629
children 8ea3f335307d
comparison
equal deleted inserted replaced
23:f9869f34f629 24:bc15b55a4114
22 size_hint: 1,None 22 size_hint: 1,None
23 height: 40 23 height: 40
24 hint_text: "Enter your message here" 24 hint_text: "Enter your message here"
25 25
26 <MessageWidget>: 26 <MessageWidget>:
27
28 mess_label: mess_label 27 mess_label: mess_label
29 size_hint: None,None 28 size_hint: 1, None
30 pos_hint: {'x': 0} if root.mess_data.own_mess else {'right': 1} 29 height: time_label.height + mess_label.height
31 height: mess_label.height + time_label.height
32 width: mess_label.width
33 on_height: if root.parent: root.parent.sizeAdjust() 30 on_height: if root.parent: root.parent.sizeAdjust()
31 on_width: self.sizeAdjust()
34 Label: 32 Label:
35 id: time_label 33 id: time_label
36 size_hint: None, None 34 text_size: None, None
35 size_hint: 1, None
37 height: self.texture_size[1] 36 height: self.texture_size[1]
38 width: root.parent.width if root.parent else 100
39 text: root.mess_data.time_text 37 text: root.mess_data.time_text
40 halign: "center" 38 halign: "center"
41 BoxLayout: 39 BoxLayout:
42 canvas.before: 40 size_hint: None,None
43 Color: 41 size: mess_label.size
44 rgba: 1, 1, 1, 1 42 pos_hint: {'x': 0} if root.mess_data.own_mess else {'right': 1}
45 BorderImage:
46 source: "cagou/images/border_{}.jpg".format("blue" if root.mess_data.own_mess else "gray")
47 pos: self.pos
48 size: self.size
49 43
50 # Label: 44 # Label:
51 # id: nick_label 45 # id: nick_label
52 # text: root.mess_data.nick 46 # text: root.mess_data.nick
53 # # text: unicode(self.texture_size) 47 # # text: unicode(self.texture_size)
61 # # width: self.texture_size[0] 55 # # width: self.texture_size[0]
62 # # height: max(self.texture_size[1], mess_label.height) 56 # # height: max(self.texture_size[1], mess_label.height)
63 # # size_hint: None, 1 57 # # size_hint: None, 1
64 # # valign: "top" 58 # # valign: "top"
65 Label: 59 Label:
60 canvas.before:
61 Color:
62 rgba: 1, 1, 1, 1
63 BorderImage:
64 source: "cagou/images/border_{}.jpg".format("blue" if root.mess_data.own_mess else "gray")
65 pos: self.pos
66 size: self.size
66 id: mess_label 67 id: mess_label
67 color: 0, 0, 0, 1 68 color: 0, 0, 0, 1
68 padding: 5, 5 69 padding: 5, 5
69 text_size: None, None 70 text_size: None, None
70 size_hint: None, None 71 size_hint: None, None
71 size: self.texture_size 72 size: self.texture_size
72 # text: 'root:{} nick:{} self:{}'.format(root.height, nick_label.height, self.height)
73 text: root.message or u' ' 73 text: root.message or u' '
74 # haligh: "left" 74 on_texture_size: root.sizeAdjust()
75 on_texture_size: root.adjustMax(self.texture_size)