Mercurial > libervia-desktop-kivy
diff 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 |
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_chat.kv Mon Aug 08 21:05:29 2016 +0200 +++ b/src/cagou/plugins/plugin_wid_chat.kv Tue Aug 09 22:06:00 2016 +0200 @@ -24,28 +24,22 @@ hint_text: "Enter your message here" <MessageWidget>: - mess_label: mess_label - size_hint: None,None - pos_hint: {'x': 0} if root.mess_data.own_mess else {'right': 1} - height: mess_label.height + time_label.height - width: mess_label.width + size_hint: 1, None + height: time_label.height + mess_label.height on_height: if root.parent: root.parent.sizeAdjust() + on_width: self.sizeAdjust() Label: id: time_label - size_hint: None, None + text_size: None, None + size_hint: 1, None height: self.texture_size[1] - width: root.parent.width if root.parent else 100 text: root.mess_data.time_text halign: "center" BoxLayout: - canvas.before: - Color: - rgba: 1, 1, 1, 1 - BorderImage: - source: "cagou/images/border_{}.jpg".format("blue" if root.mess_data.own_mess else "gray") - pos: self.pos - size: self.size + size_hint: None,None + size: mess_label.size + pos_hint: {'x': 0} if root.mess_data.own_mess else {'right': 1} # Label: # id: nick_label @@ -63,13 +57,18 @@ # # size_hint: None, 1 # # valign: "top" Label: + canvas.before: + Color: + rgba: 1, 1, 1, 1 + BorderImage: + source: "cagou/images/border_{}.jpg".format("blue" if root.mess_data.own_mess else "gray") + pos: self.pos + size: self.size id: mess_label color: 0, 0, 0, 1 padding: 5, 5 text_size: None, None size_hint: None, None size: self.texture_size - # text: 'root:{} nick:{} self:{}'.format(root.height, nick_label.height, self.height) text: root.message or u' ' - # haligh: "left" - on_texture_size: root.adjustMax(self.texture_size) + on_texture_size: root.sizeAdjust()