bridge, quick_frontend: preparation for async bridge
bridge can currently have sync and async methods. This commit prepare the transition to fully async bridges:
- a new bridgeConnect method must be called to prepare the bridge
- quick app, quick profile manager: changed sync calls to async ones
- quick app: bridgeConnect can be called automatically or manually depending on connect_bridge parameter of QuickApp
This commit is contained in:
parent
58795c675c
commit
34cec8fe14
1 changed files with 82 additions and 37 deletions
|
|
@ -108,15 +108,22 @@ class QuickProfileManager(object):
|
|||
self._autoconnect=False
|
||||
self.host.actionManager(data, callback=authenticate_cb, profile=profile)
|
||||
|
||||
for profile_key in profile_keys:
|
||||
profile = self.host.bridge.getProfileName(profile_key)
|
||||
def getProfileNameCb(profile):
|
||||
if not profile:
|
||||
# FIXME: this method is not handling manual mode correclty anymore
|
||||
# must be thought to be handled asynchronously
|
||||
self._autoconnect = False # manual mode
|
||||
msg = _("Trying to plug an unknown profile key ({})".format(profile_key))
|
||||
log.warning(msg)
|
||||
self.showDialog(_("Profile plugging in error"), msg, 'error')
|
||||
break
|
||||
self.host.launchAction(C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, profile=profile)
|
||||
self.host.showDialog(_("Profile plugging in error"), msg, 'error')
|
||||
else:
|
||||
self.host.launchAction(C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, profile=profile)
|
||||
|
||||
def getProfileNameEb(failure):
|
||||
log.error(u"Can't retrieve profile name: {}".format(failure))
|
||||
|
||||
for profile_key in profile_keys:
|
||||
self.host.bridge.getProfileName(profile_key, callback=getProfileNameCb, errback=getProfileNameEb)
|
||||
|
||||
|
||||
def getParamError(self, dummy):
|
||||
|
|
|
|||
Loading…
Reference in a new issue