comparison 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
comparison
equal deleted inserted replaced
328:dddea9684a8e 329:51520ce98154
557 self.appendMessage(mess_data) 557 self.appendMessage(mess_data)
558 super(Chat, self)._onHistoryPrinted() 558 super(Chat, self)._onHistoryPrinted()
559 559
560 def createMessage(self, message): 560 def createMessage(self, message):
561 self.appendMessage(message) 561 self.appendMessage(message)
562 # we need to render immediatly next 2 layouts to avoid an unpleasant flickering
563 # when sending or receiving a message
564 self.messages_widget.dont_delay_next_layouts = 2
562 565
563 def appendMessage(self, mess_data): 566 def appendMessage(self, mess_data):
564 """Append a message Widget to the history 567 """Append a message Widget to the history
565 568
566 @param mess_data(quick_chat.Message): message data 569 @param mess_data(quick_chat.Message): message data