# HG changeset patch # User Goffi # Date 1552289983 -3600 # Node ID 805c4103dac5c1259519de73fa26782dde2baa2e # Parent 3e11b5d923e2f0f55d464fa005add17059d20224 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. diff -r 3e11b5d923e2 -r 805c4103dac5 cagou/core/cagou_main.py --- a/cagou/core/cagou_main.py Mon Mar 11 08:39:43 2019 +0100 +++ b/cagou/core/cagou_main.py Mon Mar 11 08:39:43 2019 +0100 @@ -380,6 +380,7 @@ class Cagou(QuickApp): MB_HANDLE = False + AUTO_RESYNC = False def __init__(self): if bridge_name == 'embedded': @@ -430,6 +431,15 @@ for w in w_list: yield w + @QuickApp.sync.setter + def sync(self, state): + QuickApp.sync.fset(self, state) + # widget are resynchronised in onVisible event, + # so we must call resync for widgets which are already visible + if state: + for w in self.visible_widgets: + w.resync() + def onBridgeConnected(self): super(Cagou, self).onBridgeConnected() self.registerSignal("otrState", iface="plugin") diff -r 3e11b5d923e2 -r 805c4103dac5 cagou/plugins/plugin_wid_chat.py --- a/cagou/plugins/plugin_wid_chat.py Mon Mar 11 08:39:43 2019 +0100 +++ b/cagou/plugins/plugin_wid_chat.py Mon Mar 11 08:39:43 2019 +0100 @@ -678,6 +678,10 @@ self.encryption_btn.symbol = self.encryption_btn.getSymbol() self.encryption_btn.color = self.encryption_btn.getColor() + def onVisible(self): + if not self.sync: + self.resync() + def onDelete(self): # we always keep one widget, so it's available when swiping # TODO: delete all widgets when chat is closed