Mercurial > libervia-backend
diff frontends/src/bridge/dbus_bridge.py @ 2126:2f264f3df280
core (menus): improvments:
- use the new convention for bridge names (getMenus ==> menusGet, etc.)
- menu now use canonical path, which is the untranslated path with each element stripped and lowercase, it must be unique by menu type
- added menuLaunch method to manually launch a menu like an action, canonical path is used instead of id
- added SECURITY_LIMIT_MAX constant
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 26 Jan 2017 20:29:48 +0100 |
parents | 9c861d07b5b6 |
children | be96beb7ca14 |
line wrap: on
line diff
--- a/frontends/src/bridge/dbus_bridge.py Thu Jan 26 20:24:58 2017 +0100 +++ b/frontends/src/bridge/dbus_bridge.py Thu Jan 26 20:29:48 2017 +0100 @@ -338,34 +338,6 @@ kwargs['error_handler'] = error_handler return unicode(self.db_core_iface.getMainResource(contact_jid, profile_key, **kwargs)) - def getMenuHelp(self, menu_id, language, 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)) - kwargs={} - if callback is not None: - kwargs['timeout'] = const_TIMEOUT - kwargs['reply_handler'] = callback - kwargs['error_handler'] = error_handler - return unicode(self.db_core_iface.getMenuHelp(menu_id, language, **kwargs)) - - def getMenus(self, language, security_limit, 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)) - kwargs={} - if callback is not None: - kwargs['timeout'] = const_TIMEOUT - kwargs['reply_handler'] = callback - kwargs['error_handler'] = error_handler - return self.db_core_iface.getMenus(language, security_limit, **kwargs) - def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None @@ -528,6 +500,43 @@ kwargs['error_handler'] = error_handler return self.db_core_iface.loadParamsTemplate(filename, **kwargs) + def menuHelpGet(self, menu_id, language, 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)) + kwargs={} + if callback is not None: + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return unicode(self.db_core_iface.menuHelpGet(menu_id, language, **kwargs)) + + def menuLaunch(self, menu_type, path, data, security_limit, profile_key, 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.menuLaunch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) + + def menusGet(self, language, security_limit, 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)) + kwargs={} + if callback is not None: + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.menusGet(language, security_limit, **kwargs) + def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): if callback is None: error_handler = None