diff 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
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Tue May 22 10:06:07 2018 +0200
+++ b/sat_frontends/quick_frontend/quick_app.py	Tue May 22 10:07:33 2018 +0200
@@ -195,6 +195,9 @@
     def iteritems(self):
         return self._profiles.iteritems()
 
+    def itervalues(self):
+        return self._profiles.itervalues()
+
     def plug(self, profile):
         if profile in self._profiles:
             raise exceptions.ConflictError('A profile of the name [{}] is already plugged'.format(profile))
@@ -259,12 +262,20 @@
         self._notif_id = 0
         self._notifications = OrderedDict()
         self.features = None
+        self.ns_map = {}  # map of short name to namespaces
 
     def connectBridge(self):
         self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb)
 
+    def _namespacesGetCb(self, ns_map):
+        self.ns_map = ns_map
+
+    def _namespacesGetEb(self, failure_):
+        log.error(_(u"Can't get namespaces map: {msg}").format(msg=failure_))
+
     def onBridgeConnected(self):
-        pass
+        self.bridge.namespacesGet(callback=self._namespacesGetCb,
+                                  errback=self._namespacesGetEb)
 
     def _bridgeCb(self):
         self.registerSignal("connected")