changeset 700:b81816f42c81

browser side: added signal caching before profile is plugged, as QuickFrontend mechanism is not used
author Goffi <goffi@goffi.org>
date Wed, 27 May 2015 19:10:16 +0200
parents be55a782a976
children 9aa2e251a993
files src/browser/libervia_main.py src/browser/sat_browser/json.py
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Mon Apr 20 17:10:38 2015 +0200
+++ b/src/browser/libervia_main.py	Wed May 27 19:10:16 2015 +0200
@@ -77,6 +77,8 @@
         log.info("============ onModuleLoad ==============")
         self.bridge_signals = json.BridgeSignals(self)
         QuickApp.__init__(self, json.BridgeCall)
+        self._profile_plugged = False
+        self.signals_cache[C.PROF_KEY_NONE] = []
         self.panel = main_panel.MainPanel(self)
         self.tab_panel = self.panel.tab_panel
         self.tab_panel.addTabListener(self)
@@ -349,8 +351,9 @@
         self.bridge.getNewAccountDomain(callback=domain_cb, errback=domain_eb)
         self.plug_profiles([C.PROF_KEY_NONE]) # XXX: None was used intitially, but pyjamas bug when using variable arguments and None is the only arg.
 
-    def profilePlugged(self, dummy):  # FIXME: to be called as a "profilePlugged" listener?
-        QuickApp.profilePlugged(self, dummy)
+    def profilePlugged(self, dummy):
+        self._profile_plugged = True
+        QuickApp.profilePlugged(self, C.PROF_KEY_NONE)
 
         microblog_widget = self.displayWidget(blog.MicroblogPanel, ())
         self.setSelected(microblog_widget)
--- a/src/browser/sat_browser/json.py	Mon Apr 20 17:10:38 2015 +0200
+++ b/src/browser/sat_browser/json.py	Wed May 27 19:10:16 2015 +0200
@@ -261,4 +261,8 @@
             return
         if with_profile:
             args.append(C.PROF_KEY_NONE)
-        callback(*args)
+        if not self.host._profile_plugged:
+            log.debug("Profile is not plugged, we cache the signal")
+            self.host.signals_cache[C.PROF_KEY_NONE].append((name, callback, args, {}))
+        else:
+            callback(*args)