comparison 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
comparison
equal deleted inserted replaced
2125:ca82c97db195 2126:2f264f3df280
336 kwargs['timeout'] = const_TIMEOUT 336 kwargs['timeout'] = const_TIMEOUT
337 kwargs['reply_handler'] = callback 337 kwargs['reply_handler'] = callback
338 kwargs['error_handler'] = error_handler 338 kwargs['error_handler'] = error_handler
339 return unicode(self.db_core_iface.getMainResource(contact_jid, profile_key, **kwargs)) 339 return unicode(self.db_core_iface.getMainResource(contact_jid, profile_key, **kwargs))
340 340
341 def getMenuHelp(self, menu_id, language, callback=None, errback=None):
342 if callback is None:
343 error_handler = None
344 else:
345 if errback is None:
346 errback = log.error
347 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
348 kwargs={}
349 if callback is not None:
350 kwargs['timeout'] = const_TIMEOUT
351 kwargs['reply_handler'] = callback
352 kwargs['error_handler'] = error_handler
353 return unicode(self.db_core_iface.getMenuHelp(menu_id, language, **kwargs))
354
355 def getMenus(self, language, security_limit, callback=None, errback=None):
356 if callback is None:
357 error_handler = None
358 else:
359 if errback is None:
360 errback = log.error
361 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
362 kwargs={}
363 if callback is not None:
364 kwargs['timeout'] = const_TIMEOUT
365 kwargs['reply_handler'] = callback
366 kwargs['error_handler'] = error_handler
367 return self.db_core_iface.getMenus(language, security_limit, **kwargs)
368
369 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): 341 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None):
370 if callback is None: 342 if callback is None:
371 error_handler = None 343 error_handler = None
372 else: 344 else:
373 if errback is None: 345 if errback is None:
526 kwargs['timeout'] = const_TIMEOUT 498 kwargs['timeout'] = const_TIMEOUT
527 kwargs['reply_handler'] = callback 499 kwargs['reply_handler'] = callback
528 kwargs['error_handler'] = error_handler 500 kwargs['error_handler'] = error_handler
529 return self.db_core_iface.loadParamsTemplate(filename, **kwargs) 501 return self.db_core_iface.loadParamsTemplate(filename, **kwargs)
530 502
503 def menuHelpGet(self, menu_id, language, callback=None, errback=None):
504 if callback is None:
505 error_handler = None
506 else:
507 if errback is None:
508 errback = log.error
509 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
510 kwargs={}
511 if callback is not None:
512 kwargs['timeout'] = const_TIMEOUT
513 kwargs['reply_handler'] = callback
514 kwargs['error_handler'] = error_handler
515 return unicode(self.db_core_iface.menuHelpGet(menu_id, language, **kwargs))
516
517 def menuLaunch(self, menu_type, path, data, security_limit, profile_key, callback=None, errback=None):
518 if callback is None:
519 error_handler = None
520 else:
521 if errback is None:
522 errback = log.error
523 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
524 return self.db_core_iface.menuLaunch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
525
526 def menusGet(self, language, security_limit, callback=None, errback=None):
527 if callback is None:
528 error_handler = None
529 else:
530 if errback is None:
531 errback = log.error
532 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
533 kwargs={}
534 if callback is not None:
535 kwargs['timeout'] = const_TIMEOUT
536 kwargs['reply_handler'] = callback
537 kwargs['error_handler'] = error_handler
538 return self.db_core_iface.menusGet(language, security_limit, **kwargs)
539
531 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): 540 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
532 if callback is None: 541 if callback is None:
533 error_handler = None 542 error_handler = None
534 else: 543 else:
535 if errback is None: 544 if errback is None: