diff sat_frontends/bridge/dbus_bridge.py @ 3123:130f9cb6e0ab

core (memory/params): added `extra` argument to filter out params notably in `getParamsUI`: In some case, it may be desirable for a frontend to not expose some parameters to user (e.g. it is the case on Android with the `autoconnect_backend` parameter). An new `extra` parameter has been added to a couple of parameters method for that: it can contain the `ignore` key with a list of [category, name] of parameters to skip.
author Goffi <goffi@goffi.org>
date Sat, 25 Jan 2020 21:08:40 +0100
parents 7574f795bd1e
children 9d0df638c8b4
line wrap: on
line diff
--- a/sat_frontends/bridge/dbus_bridge.py	Sat Jan 25 21:08:39 2020 +0100
+++ b/sat_frontends/bridge/dbus_bridge.py	Sat Jan 25 21:08:40 2020 +0100
@@ -184,14 +184,14 @@
             error_handler = lambda err:errback(dbus_to_bridge_exception(err))
         return str(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
 
-    def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
+    def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@", callback=None, errback=None):
         if callback is None:
             error_handler = None
         else:
             if errback is None:
                 errback = log.error
             error_handler = lambda err:errback(dbus_to_bridge_exception(err))
-        return self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
+        return self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
 
     def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None):
         if callback is None:
@@ -400,14 +400,14 @@
             kwargs['error_handler'] = error_handler
         return self.db_core_iface.getParamsCategories(**kwargs)
 
-    def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
+    def getParamsUI(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@", callback=None, errback=None):
         if callback is None:
             error_handler = None
         else:
             if errback is None:
                 errback = log.error
             error_handler = lambda err:errback(dbus_to_bridge_exception(err))
-        return str(self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
+        return str(self.db_core_iface.getParamsUI(security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
 
     def getPresenceStatuses(self, profile_key="@DEFAULT@", callback=None, errback=None):
         if callback is None:
@@ -908,12 +908,12 @@
         self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
         return fut
 
-    def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, profile_key="@DEFAULT@"):
+    def asyncGetParamsValuesFromCategory(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"):
         loop = asyncio.get_running_loop()
         fut = loop.create_future()
         reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
         error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
-        self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
+        self.db_core_iface.asyncGetParamsValuesFromCategory(category, security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
         return fut
 
     def connect(self, profile_key="@DEFAULT@", password='', options={}):
@@ -1060,12 +1060,12 @@
         self.db_core_iface.getParamsCategories(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
         return fut
 
-    def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@"):
+    def getParamsUI(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"):
         loop = asyncio.get_running_loop()
         fut = loop.create_future()
         reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
         error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
-        self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
+        self.db_core_iface.getParamsUI(security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
         return fut
 
     def getPresenceStatuses(self, profile_key="@DEFAULT@"):