comparison 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
comparison
equal deleted inserted replaced
23:f9869f34f629 24:bc15b55a4114
50 @property 50 @property
51 def message(self): 51 def message(self):
52 """Return currently displayed message""" 52 """Return currently displayed message"""
53 return self.mess_data.main_message 53 return self.mess_data.main_message
54 54
55 def adjustMax(self, texture_size): 55 def sizeAdjust(self):
56 """this widget grows up with its children""" 56 """this widget grows up with its children"""
57 width, height = texture_size 57 text_width, text_height = self.mess_label.texture_size
58 if width > self.parent.width: 58 if text_width > self.parent.width:
59 self.mess_label.text_size = (self.parent.width - 10, None) 59 self.mess_label.text_size = (self.parent.width - 10, None)
60 self.text_max = text_width
61 elif self.mess_label.text_size[0] is not None and text_width < self.parent.width - 10:
62 if text_width > self.text_max:
63 self.mess_label.text_size = (None, None)
64 else:
65 self.mess_label.text_size = (self.parent.width - 10, None)
60 66
61 67
62 class MessageInputWidget(TextInput): 68 class MessageInputWidget(TextInput):
63 69
64 def _key_down(self, key, repeat=False): 70 def _key_down(self, key, repeat=False):