comparison sat_frontends/quick_frontend/quick_app.py @ 3204:fc2bea41e402

quick frontend(app): new `QuickApp.profileConnected` method
author Goffi <goffi@goffi.org>
date Fri, 06 Mar 2020 18:19:03 +0100
parents 65d89a339dd3
children f3c99e96ac03
comparison
equal deleted inserted replaced
3203:fee8e33e2b3f 3204:fc2bea41e402
88 ) 88 )
89 self._plug_profile_autodisconnect("false") 89 self._plug_profile_autodisconnect("false")
90 90
91 def _plug_profile_isconnected(self, connected): 91 def _plug_profile_isconnected(self, connected):
92 self.connected = connected 92 self.connected = connected
93 if connected:
94 self.host.profileConnected(self.profile)
93 self.bridge.asyncGetParamA( 95 self.bridge.asyncGetParamA(
94 "autodisconnect", 96 "autodisconnect",
95 "Connection", 97 "Connection",
96 profile_key=self.profile, 98 profile_key=self.profile,
97 callback=self._plug_profile_autodisconnect, 99 callback=self._plug_profile_autodisconnect,
661 663
662 self.callListeners("profilePlugged", profile=profile) 664 self.callListeners("profilePlugged", profile=profile)
663 if not self._plugs_in_progress: 665 if not self._plugs_in_progress:
664 self.contact_lists.lockUpdate(False) 666 self.contact_lists.lockUpdate(False)
665 667
668 def profileConnected(self, profile):
669 """Called when a plugged profile is connected
670
671 it is called independently of profilePlugged (may be called before or after
672 profilePlugged)
673 """
674 pass
675
666 def connect(self, profile, callback=None, errback=None): 676 def connect(self, profile, callback=None, errback=None):
667 if not callback: 677 if not callback:
668 callback = lambda __: None 678 callback = lambda __: None
669 if not errback: 679 if not errback:
670 680
740 # FIXME: self.sync is for all profiles 750 # FIXME: self.sync is for all profiles
741 # while (dis)connection is per-profile. 751 # while (dis)connection is per-profile.
742 # A mechanism similar to sync should be available 752 # A mechanism similar to sync should be available
743 # on a per-profile basis 753 # on a per-profile basis
744 self.sync = True 754 self.sync = True
755 self.profileConnected(profile)
745 756
746 def disconnectedHandler(self, profile): 757 def disconnectedHandler(self, profile):
747 """called when the connection is closed""" 758 """called when the connection is closed"""
748 log.debug(_("Disconnected")) 759 log.debug(_("Disconnected"))
749 self.contact_lists[profile].disconnect() 760 self.contact_lists[profile].disconnect()