# HG changeset patch # User Goffi # Date 1481981685 -3600 # Node ID 4a1e1012337e2ca2f2ab7d2a331a1c49ccc7280c # Parent 5f7f72c2635f5dcecd9d80e87030878e04fab7b7 chat: fixed chat messages width diff -r 5f7f72c2635f -r 4a1e1012337e src/cagou/plugins/plugin_wid_chat.py --- a/src/cagou/plugins/plugin_wid_chat.py Sat Dec 17 14:32:40 2016 +0100 +++ b/src/cagou/plugins/plugin_wid_chat.py Sat Dec 17 14:34:45 2016 +0100 @@ -156,16 +156,23 @@ if len(self.children) == 1: wid = self.children[0] if isinstance(wid, Label): + # we have simple text try: full_width = wid._full_width except AttributeError: + # on first time, we need the required size + # for the full text, without width limit wid.size_hint = (None, None) wid.texture_update() full_width = wid._full_width = wid.texture_size[0] + if full_width > width: wid.text_size = width, None + wid.width = width else: wid.text_size = None, None + wid.texture_update() + wid.width = wid.texture_size[0] self.content_width = wid.width + self.padding[0] + self.padding[2] else: wid.size_hint(1, None)