comparison sat_frontends/quick_frontend/quick_app.py @ 2590:bd9d92bc0d6c

quick frontends (app): retrieve namespaces on startup
author Goffi <goffi@goffi.org>
date Tue, 22 May 2018 10:07:33 +0200
parents 57c8c155192f
children fe9888d3fcb6
comparison
equal deleted inserted replaced
2589:282d1314d574 2590:bd9d92bc0d6c
192 def __len__(self): 192 def __len__(self):
193 return len(self._profiles) 193 return len(self._profiles)
194 194
195 def iteritems(self): 195 def iteritems(self):
196 return self._profiles.iteritems() 196 return self._profiles.iteritems()
197
198 def itervalues(self):
199 return self._profiles.itervalues()
197 200
198 def plug(self, profile): 201 def plug(self, profile):
199 if profile in self._profiles: 202 if profile in self._profiles:
200 raise exceptions.ConflictError('A profile of the name [{}] is already plugged'.format(profile)) 203 raise exceptions.ConflictError('A profile of the name [{}] is already plugged'.format(profile))
201 self._profiles[profile] = ProfileManager(profile) 204 self._profiles[profile] = ProfileManager(profile)
257 self.connectBridge() 260 self.connectBridge()
258 261
259 self._notif_id = 0 262 self._notif_id = 0
260 self._notifications = OrderedDict() 263 self._notifications = OrderedDict()
261 self.features = None 264 self.features = None
265 self.ns_map = {} # map of short name to namespaces
262 266
263 def connectBridge(self): 267 def connectBridge(self):
264 self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb) 268 self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb)
265 269
270 def _namespacesGetCb(self, ns_map):
271 self.ns_map = ns_map
272
273 def _namespacesGetEb(self, failure_):
274 log.error(_(u"Can't get namespaces map: {msg}").format(msg=failure_))
275
266 def onBridgeConnected(self): 276 def onBridgeConnected(self):
267 pass 277 self.bridge.namespacesGet(callback=self._namespacesGetCb,
278 errback=self._namespacesGetEb)
268 279
269 def _bridgeCb(self): 280 def _bridgeCb(self):
270 self.registerSignal("connected") 281 self.registerSignal("connected")
271 self.registerSignal("disconnected") 282 self.registerSignal("disconnected")
272 self.registerSignal("actionNew") 283 self.registerSignal("actionNew")