Mercurial > libervia-web
diff libervia.py @ 205:ee744ffed7fc
browser side: events data are cached until initialisation is finished (we get all microblogs)
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 20 Jun 2013 12:16:46 +0200 |
parents | 890776a6fdb7 |
children | 3092f6b1710c |
line wrap: on
line diff
--- a/libervia.py Thu Jun 20 12:16:46 2013 +0200 +++ b/libervia.py Thu Jun 20 12:16:46 2013 +0200 @@ -164,6 +164,8 @@ self.resize() self._register = RegisterCall() self._register.call('isRegistered',self._isRegisteredCB) + self.initialised = False + self.init_cache = [] # used to cache events until initialisation is done def addSelectedListener(self, callback): self._selected_listeners.add(callback) @@ -358,6 +360,10 @@ for lib_wid in self.libervia_widgets: if isinstance(lib_wid, panels.MicroblogPanel): self.FillMicroblogPanel(lib_wid) + self.initialised = True # initialisation phase is finished here + for event_data in self.init_cache: # so we have to send all the cached events + self._personalEventCb(*event_data) + del self.init_cache def _getProfileJidCB(self, jid): self.whoami = JID(jid) @@ -381,6 +387,9 @@ ## Signals callbacks ## def _personalEventCb(self, sender, event_type, data): + if not self.initialised: + self.init_cache.append((sender, event_type, data)) + return if event_type == "MICROBLOG": if not 'content' in data: print ("WARNING: No content found in microblog data")