quick frontend (menus): minor docstring fixes

This commit is contained in:
Goffi 2016-09-11 11:03:25 +02:00
commit bd47ab8d3d

View file

@ -135,7 +135,7 @@ class MenuItemDistant(MenuItem):
class MenuItemLocal(MenuItem):
"""A MenuItem with a distant callback"""
"""A MenuItem with a local callback"""
CALLABLE=True
def __init__(self, type_, name, name_i18n, callback, extra=None):
@ -143,7 +143,9 @@ class MenuItemLocal(MenuItem):
@param type_(unicode): same as in [sat.core.sat_main.SAT.importMenu]
@param name(unicode): canonical name of the item
@param name_i18n(unicode): translated name of the item
@param callback(callable): local callback. Will be called with the caller as only argument if data_collector is None, else with the caller + requested data + profile.
@param callback(callable): local callback.
Will be called with no argument if data_collector is None
and with caller, profile, and requested data otherwise
@param extra(dict[unicode, unicode], None): same as in [addMenus]
"""
MenuItem.__init__(self, name, name_i18n, extra, type_)
@ -152,6 +154,7 @@ class MenuItemLocal(MenuItem):
def call(self, caller, profile=C.PROF_KEY_NONE):
data_collector = QuickMenusManager.getDataCollector(self.type)
if data_collector is None:
# FIXME: would not it be better if caller and profile where used as arguments?
self.callback()
else:
self.callback(caller, self.collectData(caller), profile)
@ -310,7 +313,9 @@ class QuickMenusManager(object):
A data collector is a method or a map which allow to collect context data to construct the dictionnary which will be sent to the bridge method managing the menu item.
@param type_(unicode): same as in [sat.core.sat_main.SAT.importMenu]
@param data_collector(dict[unicode,unicode], callable, None): can be:
- a dict which map data name to local name. The attribute named after the dict values will be getted from caller, and put in data. e.g.: if data_collector={'room_jid':'target'}, then the "room_jid" data will be the value of the "target" attribute of the caller.
- a dict which map data name to local name.
The attribute named after the dict values will be getted from caller, and put in data.
e.g.: if data_collector={'room_jid':'target'}, then the "room_jid" data will be the value of the "target" attribute of the caller.
- a callable which must return the data dictionnary. callable will have caller and item name as argument
- None: an empty dict will be used
"""