From 126d95e764133bfafbb163bfc570c43fd4e180b8 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 25 Jun 2014 20:54:15 +0200 Subject: [PATCH] core (menus): constants are used for menu types --- src/core/constants.py | 9 +++++++++ src/core/sat_main.py | 20 +++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/core/constants.py b/src/core/constants.py index 1ca52dcb..d7cac3d1 100644 --- a/src/core/constants.py +++ b/src/core/constants.py @@ -58,6 +58,15 @@ class Const(object): 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@' diff --git a/src/core/sat_main.py b/src/core/sat_main.py index 2a4cf4fb..bce177c1 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -285,7 +285,7 @@ class SAT(service.Service): """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 @@ class SAT(service.Service): #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 @@ class SAT(service.Service): @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) """