frontends: add listeners 'profilePlugged', 'disconnect' and 'gotMenus' (the last one to be removed when the menus are refactored to quick_app)

This commit is contained in:
souliane 2015-03-03 22:17:57 +01:00
commit 16cdbbbe1f

View file

@ -390,6 +390,8 @@ class QuickApp(object):
for function_name, handler, args, kwargs in cached_signals:
log.debug(u"Calling cached signal [%s] with args %s and kwargs %s" % (function_name, args, kwargs))
self.callListeners('profilePlugged', profile=profile)
def asyncConnect(self, profile, callback=None, errback=None):
if not callback:
callback = lambda dummy: None
@ -740,6 +742,11 @@ class QuickApp(object):
"""
raise NotImplementedError
def disconnect(self, profile):
log.info("disconnecting")
self.callListeners('disconnect', profile=profile)
self.bridge.disconnect(profile)
def onExit(self):
"""Must be called when the frontend is terminating"""
to_unplug = []
@ -747,7 +754,7 @@ class QuickApp(object):
if self.bridge.isConnected(profile):
if C.bool(self.bridge.getParamA("autodisconnect", "Connection", profile_key=profile)):
#The user wants autodisconnection
self.bridge.disconnect(profile)
self.disconnect(profile)
to_unplug.append(profile)
for profile in to_unplug:
self.unplug_profile(profile)