Mercurial > libervia-backend
changeset 1026:71fdc327b318
core: getReady and asyncConnect now wait full initialisation, not only memory
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 15 May 2014 20:01:56 +0200 |
parents | 24fe24cfb363 |
children | ee46515a12f2 |
files | src/core/sat_main.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/sat_main.py Thu May 15 19:51:53 2014 +0200 +++ b/src/core/sat_main.py Thu May 15 20:01:56 2014 +0200 @@ -82,6 +82,7 @@ self._cb_map = {} # map from callback_id to callbacks self._menus = OrderedDict() # dynamic menus. key: callback_id, value: menu data (dictionnary) self.__private_data = {} # used for internal callbacks (key = id) FIXME: to be removed + self._initialised = defer.Deferred() self.profiles = {} self.plugins = {} @@ -93,7 +94,7 @@ except exceptions.BridgeInitError: log.error(u"Bridge can't be initialised, can't start SàT core") sys.exit(1) - self.bridge.register("getReady", lambda: self.memory.initialized) + self.bridge.register("getReady", lambda: self._initialized) self.bridge.register("getVersion", lambda: C.APP_VERSION) self.bridge.register("getProfileName", self.memory.getProfileName) self.bridge.register("getProfilesList", self.memory.getProfilesList) @@ -144,6 +145,7 @@ log.info(_("Memory initialised")) self._import_plugins() ui_contact_list.ContactList(self) + self._initialised.callback(None) def _import_plugins(self): """Import all plugins found in plugins directory""" @@ -204,7 +206,7 @@ """Connect to jabber server with asynchronous reply @param profile_key: %(doc_profile)s """ - def backend_initialized(ignore): + def backendInitialised(dummy): profile = self.memory.getProfileName(profile_key) if not profile: log.error(_('Trying to connect a non-existant profile')) @@ -287,7 +289,7 @@ self.memory.startProfileSession(profile) return self.memory.loadIndividualParams(profile).addCallback(afterMemoryInit) - return self.memory.initialized.addCallback(backend_initialized) + return self._initialised.addCallback(backendInitialised) def disconnect(self, profile_key): """disconnect from jabber server"""