Mercurial > libervia-backend
comparison frontends/src/bridge/DBus.py @ 773:eac23b1aad90
core: dynamics menus refactoring:
- menu now use generic callback system, with extra data
- asyncMenuCall is removed in favor of launchAction
- menu_id (== callback_id) is used to identify menu instead of category/name/type tuple
- i18n is managed throught deferred translation, and returned with _i18n suffix
e.g.: menu (D_('File'), D_('Open')): (u'File', u'Open') is menu_path, (u'Fichier', u'Ouvrir') is french menu_path_i18n.
- type actually can have the following values:
- NORMAL: classical menu
- JID_CONTEXT: contextual menu, used with any jid
- ROSTER_JID_CONTEXT: like JID_CONTEXT, but restricted to jids in roster.
- ROSTER_GROUP_CONTEXT: contextual menu, use with groups
- security_limit is used, in the same way as for parameters
- when using importMenu, callback can be an actual callback, or one already registered with registerCallback
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 29 Dec 2013 17:10:14 +0100 |
parents | bfabeedbf32e |
children | 5642939d254e |
comparison
equal
deleted
inserted
replaced
772:dd07fc737d6c | 773:eac23b1aad90 |
---|---|
96 | 96 |
97 return getPluginMethod | 97 return getPluginMethod |
98 def addContact(self, entity_jid, profile_key="@DEFAULT@"): | 98 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
99 return self.db_core_iface.addContact(entity_jid, profile_key) | 99 return self.db_core_iface.addContact(entity_jid, profile_key) |
100 | 100 |
101 def asyncCallMenu(self, category, name, menu_type, profile_key, callback=None, errback=None): | |
102 return unicode(self.db_core_iface.asyncCallMenu(category, name, menu_type, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))) | |
103 | |
104 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): | 101 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): |
105 return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) | 102 return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) |
106 | 103 |
107 def asyncCreateProfile(self, profile, callback=None, errback=None): | 104 def asyncCreateProfile(self, profile, callback=None, errback=None): |
108 return self.db_core_iface.asyncCreateProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) | 105 return self.db_core_iface.asyncCreateProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) |
144 return self.db_core_iface.getHistory(from_jid, to_jid, limit, between, profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) | 141 return self.db_core_iface.getHistory(from_jid, to_jid, limit, between, profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])) |
145 | 142 |
146 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): | 143 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): |
147 return unicode(self.db_core_iface.getLastResource(contact_jid, profile_key)) | 144 return unicode(self.db_core_iface.getLastResource(contact_jid, profile_key)) |
148 | 145 |
149 def getMenuHelp(self, category, name, menu_type): | 146 def getMenuHelp(self, menu_id, language): |
150 return unicode(self.db_core_iface.getMenuHelp(category, name, menu_type)) | 147 return unicode(self.db_core_iface.getMenuHelp(menu_id, language)) |
151 | 148 |
152 def getMenus(self, ): | 149 def getMenus(self, language, security_limit): |
153 return self.db_core_iface.getMenus() | 150 return self.db_core_iface.getMenus(language, security_limit) |
154 | 151 |
155 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): | 152 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
156 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key)) | 153 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key)) |
157 | 154 |
158 def getParams(self, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): | 155 def getParams(self, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): |