diff frontends/src/quick_frontend/quick_app.py @ 1655:ad2ad28b8923

quick_frontend: getFeatures is called on profile plug, and saved in host.features
author Goffi <goffi@goffi.org>
date Mon, 23 Nov 2015 23:30:41 +0100
parents e00f450c25fc
children 683b76c1145d
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Mon Nov 23 23:30:41 2015 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Mon Nov 23 23:30:41 2015 +0100
@@ -79,6 +79,14 @@
     def _plug_profile_afterconnect(self):
         # Profile can be connected or not
         # we get cached data
+        self.host.bridge.getFeatures(profile_key=self.profile, callback=self._plug_profile_getFeaturesCb, errback=self._plug_profile_getFeaturesEb)
+
+    def _plug_profile_getFeaturesEb(self, failure):
+        log.error(u"Couldn't get features: {}".format(failure))
+        self._plug_profile_getFeaturesCb({})
+
+    def _plug_profile_getFeaturesCb(self, features):
+        self.host.features = features
         self.host.bridge.getEntitiesData([], ProfileManager.cache_keys_to_get, profile=self.profile, callback=self._plug_profile_gotCachedValues, errback=self._plug_profile_failedCachedValues)
 
     def _plug_profile_failedCachedValues(self, failure):
@@ -270,6 +278,7 @@
         self.current_action_ids = set() # FIXME: to be removed
         self.current_action_ids_cb = {} # FIXME: to be removed
         self.media_dir = self.bridge.getConfig('', 'media_dir')
+        self.features = None
 
     @property
     def current_profile(self):