Mercurial > libervia-backend
comparison 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 | 93bd868b8fb6 |
children | 5642939d254e |
comparison
equal
deleted
inserted
replaced
772:dd07fc737d6c | 773:eac23b1aad90 |
---|---|
190 async_callbacks=None) | 190 async_callbacks=None) |
191 def addContact(self, entity_jid, profile_key="@DEFAULT@"): | 191 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
192 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) | 192 return self._callback("addContact", unicode(entity_jid), unicode(profile_key)) |
193 | 193 |
194 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 194 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
195 in_signature='ssss', out_signature='s', | |
196 async_callbacks=('callback', 'errback')) | |
197 def asyncCallMenu(self, category, name, menu_type, profile_key, callback=None, errback=None): | |
198 return self._callback("asyncCallMenu", unicode(category), unicode(name), unicode(menu_type), unicode(profile_key), callback=callback, errback=errback) | |
199 | |
200 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | |
201 in_signature='s', out_signature='', | 195 in_signature='s', out_signature='', |
202 async_callbacks=('callback', 'errback')) | 196 async_callbacks=('callback', 'errback')) |
203 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): | 197 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): |
204 return self._callback("asyncConnect", unicode(profile_key), callback=callback, errback=errback) | 198 return self._callback("asyncConnect", unicode(profile_key), callback=callback, errback=errback) |
205 | 199 |
286 async_callbacks=None) | 280 async_callbacks=None) |
287 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): | 281 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): |
288 return self._callback("getLastResource", unicode(contact_jid), unicode(profile_key)) | 282 return self._callback("getLastResource", unicode(contact_jid), unicode(profile_key)) |
289 | 283 |
290 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 284 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
291 in_signature='sss', out_signature='s', | 285 in_signature='ss', out_signature='s', |
292 async_callbacks=None) | 286 async_callbacks=None) |
293 def getMenuHelp(self, category, name, menu_type): | 287 def getMenuHelp(self, menu_id, language): |
294 return self._callback("getMenuHelp", unicode(category), unicode(name), unicode(menu_type)) | 288 return self._callback("getMenuHelp", unicode(menu_id), unicode(language)) |
295 | 289 |
296 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 290 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
297 in_signature='', out_signature='a(sss)', | 291 in_signature='si', out_signature='a(ssasas)', |
298 async_callbacks=None) | 292 async_callbacks=None) |
299 def getMenus(self, ): | 293 def getMenus(self, language, security_limit): |
300 return self._callback("getMenus", ) | 294 return self._callback("getMenus", unicode(language), security_limit) |
301 | 295 |
302 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, | 296 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, |
303 in_signature='ssss', out_signature='s', | 297 in_signature='ssss', out_signature='s', |
304 async_callbacks=None) | 298 async_callbacks=None) |
305 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): | 299 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |