changeset 1092:0eefc74c346b

core (menus): constants are used for menu types
author Goffi <goffi@goffi.org>
date Wed, 25 Jun 2014 20:54:15 +0200
parents 2d035aaea13b
children 11e2bb20e896
files src/core/constants.py src/core/sat_main.py
diffstat 2 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/constants.py	Wed Jun 25 19:11:30 2014 +0200
+++ b/src/core/constants.py	Wed Jun 25 20:54:15 2014 +0200
@@ -58,6 +58,15 @@
     STATIC_BLOG_PARAM_KEYWORDS = "Keywords"
     STATIC_BLOG_PARAM_DESCRIPTION = "Description"
 
+    ## Menus ##
+
+    MENU_GLOBAL = "GLOBAL"
+    MENU_ROOM = "ROOM"
+    MENU_SINGLE = "SINGLE"
+    MENU_JID_CONTEXT = "JID_CONTEXT"
+    MENU_ROSTER_JID_CONTEXT = "ROSTER_JID_CONTEXT"
+    MENU_ROSTER_GROUP_CONTEXT = "MENU_ROSTER_GROUP_CONTEXT"
+
     ## Profile and entities ##
     PROF_KEY_NONE = '@NONE@'
     PROF_KEY_DEFAULT = '@DEFAULT@'
--- a/src/core/sat_main.py	Wed Jun 25 19:11:30 2014 +0200
+++ b/src/core/sat_main.py	Wed Jun 25 20:54:15 2014 +0200
@@ -285,7 +285,7 @@
         """Authenticate the profile.
 
         @param password (string): the SàT profile password
-        @param profile_key: %(doc_profile_key)s
+        @param profile: %(doc_profile)s
         @return: Deferred: a deferred None in case of success, a failure otherwise.
         """
         session_data = self.memory.auth_sessions.profileGetUnique(profile)
@@ -771,7 +771,7 @@
 
     #Menus management
 
-    def importMenu(self, path, callback, security_limit=C.NO_SECURITY_LIMIT, help_string="", type_="NORMAL"):
+    def importMenu(self, path, callback, security_limit=C.NO_SECURITY_LIMIT, help_string="", type_=C.MENU_GLOBAL):
         """register a new menu for frontends
         @param path: path to go to the menu (category/subcategory/.../item), must be an iterable (e.g.: ("File", "Open"))
             /!\ use D_() instead of _() for translations (e.g. (D_("File"), D_("Open")))
@@ -781,11 +781,17 @@
         @param help_string: string used to indicate what the menu do (can be show as a tooltip).
             /!\ use D_() instead of _() for translations
         @param type: one of:
-            - GLOBAL: classical menu, can be shown in a menubar on top (e.g. something like File/Open)
-            - ROOM: like a global menu, but only shown in multi-user chat
-            - JID_CONTEXT: contextual menu, used with any jid (e.g.: ad hoc commands, jid is already filled)
-            - ROSTER_JID_CONTEXT: like JID_CONTEXT, but restricted to jids in roster.
-            - ROSTER_GROUP_CONTEXT: contextual menu, used with group (e.g.: publish microblog, group is already filled)
+            - C.MENU_GLOBAL: classical menu, can be shown in a menubar on top (e.g. something like File/Open)
+            - C.MENU_ROOM: like a global menu, but only shown in multi-user chat
+                menu_data must contain a "room_jid" data
+            - C.MENU_SINGLE: like a global menu, but only shown in one2one chat
+                menu_data must contain a "jid" data
+            - C.MENU_JID_CONTEXT: contextual menu, used with any jid (e.g.: ad hoc commands, jid is already filled)
+                menu_data must contain a "jid" data
+            - C.MENU_ROSTER_JID_CONTEXT: like JID_CONTEXT, but restricted to jids in roster.
+                menu_data must contain a "room_jid" data
+            - C.MENU_ROSTER_GROUP_CONTEXT: contextual menu, used with group (e.g.: publish microblog, group is already filled)
+                menu_data must contain a "group" data
         @return: menu_id (same as callback_id)
         """