Mercurial > libervia-desktop-kivy
diff src/cagou/plugins/plugin_wid_chat.py @ 24:bc15b55a4114
chat: better bubble and time resizing
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 09 Aug 2016 22:06:00 +0200 |
parents | 74117b733bac |
children | d09bd16dbbe2 |
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_chat.py Mon Aug 08 21:05:29 2016 +0200 +++ b/src/cagou/plugins/plugin_wid_chat.py Tue Aug 09 22:06:00 2016 +0200 @@ -52,11 +52,17 @@ """Return currently displayed message""" return self.mess_data.main_message - def adjustMax(self, texture_size): + def sizeAdjust(self): """this widget grows up with its children""" - width, height = texture_size - if width > self.parent.width: + text_width, text_height = self.mess_label.texture_size + if text_width > self.parent.width: self.mess_label.text_size = (self.parent.width - 10, None) + self.text_max = text_width + elif self.mess_label.text_size[0] is not None and text_width < self.parent.width - 10: + if text_width > self.text_max: + self.mess_label.text_size = (None, None) + else: + self.mess_label.text_size = (self.parent.width - 10, None) class MessageInputWidget(TextInput):