comparison sat_frontends/quick_frontend/quick_app.py @ 2685:eb69ec549d05

quick frontend (app): create the contact list immediatly on plug This avoid crash when contact list is used while connexion is not done yet or not possible (e.g. server unavailable).
author Goffi <goffi@goffi.org>
date Mon, 05 Nov 2018 09:13:05 +0100
parents bdb8276fd2da
children 378188abe941
comparison
equal deleted inserted replaced
2684:a7529543bbb1 2685:eb69ec549d05
71 autodisconnect = False 71 autodisconnect = False
72 return autodisconnect 72 return autodisconnect
73 73
74 def plug(self): 74 def plug(self):
75 """Plug the profile to the host""" 75 """Plug the profile to the host"""
76 # first of all we create the contact lists
77 self.host.contact_lists.addProfile(self.profile)
78
76 # we get the essential params 79 # we get the essential params
77 self.bridge.asyncGetParamA( 80 self.bridge.asyncGetParamA(
78 "JabberID", 81 "JabberID",
79 "Connection", 82 "Connection",
80 profile_key=self.profile, 83 profile_key=self.profile,
153 def _plug_profile_failedCachedValues(self, failure): 156 def _plug_profile_failedCachedValues(self, failure):
154 log.error(u"Couldn't get cached values: {}".format(failure)) 157 log.error(u"Couldn't get cached values: {}".format(failure))
155 self._plug_profile_gotCachedValues({}) 158 self._plug_profile_gotCachedValues({})
156 159
157 def _plug_profile_gotCachedValues(self, cached_values): 160 def _plug_profile_gotCachedValues(self, cached_values):
161 contact_list = self.host.contact_lists[self.profile]
158 # add the contact list and its listener 162 # add the contact list and its listener
159 contact_list = self.host.contact_lists.addProfile(self.profile)
160
161 for entity_s, data in cached_values.iteritems(): 163 for entity_s, data in cached_values.iteritems():
162 for key, value in data.iteritems(): 164 for key, value in data.iteritems():
163 self.host.entityDataUpdatedHandler(entity_s, key, value, self.profile) 165 self.host.entityDataUpdatedHandler(entity_s, key, value, self.profile)
164 166
165 if not self.connected: 167 if not self.connected: