Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_wid_chat.py @ 265:805c4103dac5
core: resync widgets only when they are visible:
using AUTO_RESYNC from QuickApp was causing performance trouble (resynchronising all widgets was freezing the frontend for a little while).
By resynchronising only when the widget is visible, this should be greatly improved.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 11 Mar 2019 08:39:43 +0100 |
parents | a579eda31f4f |
children | a0835f0212d8 |
comparison
equal
deleted
inserted
replaced
264:3e11b5d923e2 | 265:805c4103dac5 |
---|---|
676 log.error(_(u"Unknown OTR state received: {}".format(state))) | 676 log.error(_(u"Unknown OTR state received: {}".format(state))) |
677 return | 677 return |
678 self.encryption_btn.symbol = self.encryption_btn.getSymbol() | 678 self.encryption_btn.symbol = self.encryption_btn.getSymbol() |
679 self.encryption_btn.color = self.encryption_btn.getColor() | 679 self.encryption_btn.color = self.encryption_btn.getColor() |
680 | 680 |
681 def onVisible(self): | |
682 if not self.sync: | |
683 self.resync() | |
684 | |
681 def onDelete(self): | 685 def onDelete(self): |
682 # we always keep one widget, so it's available when swiping | 686 # we always keep one widget, so it's available when swiping |
683 # TODO: delete all widgets when chat is closed | 687 # TODO: delete all widgets when chat is closed |
684 nb_instances = sum(1 for _ in self.host.widgets.getWidgetInstances(self)) | 688 nb_instances = sum(1 for _ in self.host.widgets.getWidgetInstances(self)) |
685 if nb_instances > 1: | 689 if nb_instances > 1: |