diff cagou/plugins/plugin_wid_chat.py @ 329:51520ce98154

common_widgets (DelayedBoxLayout), chat: don't delay layout on new message: DelayedBoxLayout has a new `dont_delay_next_layouts` property to skip delaying for the next X sizing. This is used in chat widget to avoid unpleasant flickering when a new message is sent or received.
author Goffi <goffi@goffi.org>
date Fri, 20 Dec 2019 12:29:37 +0100
parents d9d2b56f46db
children 13bc00b9743a
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Fri Dec 20 12:29:37 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Fri Dec 20 12:29:37 2019 +0100
@@ -559,6 +559,9 @@
 
     def createMessage(self, message):
         self.appendMessage(message)
+        # we need to render immediatly next 2 layouts to avoid an unpleasant flickering
+        # when sending or receiving a message
+        self.messages_widget.dont_delay_next_layouts = 2
 
     def appendMessage(self, mess_data):
         """Append a message Widget to the history