Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 1348:a39d2db03c80 frontends_multi_profiles
frontends: add listeners 'profilePlugged', 'disconnect' and 'gotMenus' (the last one to be removed when the menus are refactored to quick_app)
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 03 Mar 2015 22:17:57 +0100 |
parents | ba41a81d14c2 |
children | ec43552f5f8b |
comparison
equal
deleted
inserted
replaced
1347:ba41a81d14c2 | 1348:a39d2db03c80 |
---|---|
388 # profile is ready, we can call send signals that where is cache | 388 # profile is ready, we can call send signals that where is cache |
389 cached_signals = self.signals_cache.pop(profile, []) | 389 cached_signals = self.signals_cache.pop(profile, []) |
390 for function_name, handler, args, kwargs in cached_signals: | 390 for function_name, handler, args, kwargs in cached_signals: |
391 log.debug(u"Calling cached signal [%s] with args %s and kwargs %s" % (function_name, args, kwargs)) | 391 log.debug(u"Calling cached signal [%s] with args %s and kwargs %s" % (function_name, args, kwargs)) |
392 | 392 |
393 self.callListeners('profilePlugged', profile=profile) | |
394 | |
393 def asyncConnect(self, profile, callback=None, errback=None): | 395 def asyncConnect(self, profile, callback=None, errback=None): |
394 if not callback: | 396 if not callback: |
395 callback = lambda dummy: None | 397 callback = lambda dummy: None |
396 if not errback: | 398 if not errback: |
397 def errback(failure): | 399 def errback(failure): |
738 @param profile_key: %(doc_profile)s | 740 @param profile_key: %(doc_profile)s |
739 | 741 |
740 """ | 742 """ |
741 raise NotImplementedError | 743 raise NotImplementedError |
742 | 744 |
745 def disconnect(self, profile): | |
746 log.info("disconnecting") | |
747 self.callListeners('disconnect', profile=profile) | |
748 self.bridge.disconnect(profile) | |
749 | |
743 def onExit(self): | 750 def onExit(self): |
744 """Must be called when the frontend is terminating""" | 751 """Must be called when the frontend is terminating""" |
745 to_unplug = [] | 752 to_unplug = [] |
746 for profile in self.profiles: | 753 for profile in self.profiles: |
747 if self.bridge.isConnected(profile): | 754 if self.bridge.isConnected(profile): |
748 if C.bool(self.bridge.getParamA("autodisconnect", "Connection", profile_key=profile)): | 755 if C.bool(self.bridge.getParamA("autodisconnect", "Connection", profile_key=profile)): |
749 #The user wants autodisconnection | 756 #The user wants autodisconnection |
750 self.bridge.disconnect(profile) | 757 self.disconnect(profile) |
751 to_unplug.append(profile) | 758 to_unplug.append(profile) |
752 for profile in to_unplug: | 759 for profile in to_unplug: |
753 self.unplug_profile(profile) | 760 self.unplug_profile(profile) |