quick_frontends: added "menu" listeners, which is called when a menu is added or removed.

This commit is contained in:
Goffi 2015-03-17 19:33:04 +01:00
commit 991a2cbf33
2 changed files with 11 additions and 4 deletions

View file

@ -71,4 +71,4 @@ class Const(constants.Const):
WIDGET_RAISE = 'RAISE'
WIDGET_RECREATE = 'RECREATE'
LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus'}
LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus', 'menu'}

View file

@ -312,11 +312,18 @@ class QuickApp(object):
/!\ don't forget to remove listener when not used anymore (e.g. if you delete a widget)
@param type_: type of event, can be:
- avatar: called when avatar data is updated
args: (entity, avatar file, profile)
args: (entity, avatar file, profile)
- nick: called when nick data is updated
args: (entity, new_nick, profile)
args: (entity, new_nick, profile)
- presence: called when a presence is received
args: (entity, show, priority, statuses, profile)
args: (entity, show, priority, statuses, profile)
- menu: called when a menu item is added or removed
args: (type_, path, path_i18n, item) were values are:
type_: same as in [sat.core.sat_main.SAT.importMenu]
path: same as in [sat.core.sat_main.SAT.importMenu]
path_i18n: translated path (or None if the item is removed)
item: instance of quick_menus.MenuItemBase or None if the item is removed
- gotMenus: called only once when menu are available (no arg)
@param callback: method to call on event
@param profiles_filter (set[unicode]): if set and not empty, the
listener will be callable only by one of the given profiles.