changeset 1363:fa77e40eb17b frontends_multi_profiles

quick_frontends: added "menu" listeners, which is called when a menu is added or removed.
author Goffi <goffi@goffi.org>
date Tue, 17 Mar 2015 19:33:04 +0100
parents 99d596613661
children 28f0b33ca17c
files frontends/src/quick_frontend/constants.py frontends/src/quick_frontend/quick_app.py
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/constants.py	Tue Mar 17 19:30:43 2015 +0100
+++ b/frontends/src/quick_frontend/constants.py	Tue Mar 17 19:33:04 2015 +0100
@@ -71,4 +71,4 @@
     WIDGET_RAISE = 'RAISE'
     WIDGET_RECREATE = 'RECREATE'
 
-    LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus'}
+    LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus', 'menu'}
--- a/frontends/src/quick_frontend/quick_app.py	Tue Mar 17 19:30:43 2015 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Tue Mar 17 19:33:04 2015 +0100
@@ -312,11 +312,18 @@
         /!\ 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.