comparison frontends/src/bridge/DBus.py @ 421:28e4299d4553

primitivus: profile manager updated to use new asynchronous profile creation
author Goffi <goffi@goffi.org>
date Wed, 02 Nov 2011 22:50:06 +0100
parents dd4caab17008
children 6c20c76abdcc
comparison
equal deleted inserted replaced
420:acd908528ef7 421:28e4299d4553
22 from bridge_frontend import BridgeFrontend 22 from bridge_frontend import BridgeFrontend
23 import dbus, dbus.glib 23 import dbus, dbus.glib
24 from logging import debug, error 24 from logging import debug, error
25 25
26 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix 26 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
27 const_ERROR_PREFIX = const_INT_PREFIX+".error"
27 const_OBJ_PATH = '/org/goffi/SAT/bridge' 28 const_OBJ_PATH = '/org/goffi/SAT/bridge'
28 const_CORE_SUFFIX = ".core" 29 const_CORE_SUFFIX = ".core"
29 const_PLUGIN_SUFFIX = ".plugin" 30 const_PLUGIN_SUFFIX = ".plugin"
30 31
31 class BridgeExceptionNoService(Exception): 32 class BridgeExceptionNoService(Exception):
58 59
59 def addContact(self, entity_jid, profile_key="@DEFAULT@"): 60 def addContact(self, entity_jid, profile_key="@DEFAULT@"):
60 return self.db_core_iface.addContact(entity_jid, profile_key) 61 return self.db_core_iface.addContact(entity_jid, profile_key)
61 62
62 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): 63 def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
63 return self.db_core_iface.asyncConnect(profile_key, reply_handler=callback, error_handler=errback) 64 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:]))
65
66 def asyncCreateProfile(self, profile, callback=None, errback=None):
67 return self.db_core_iface.asyncCreateProfile(profile, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
64 68
65 def asyncGetParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): 69 def asyncGetParamA(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None):
66 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, profile_key, reply_handler=callback, error_handler=errback)) 70 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
67 71
68 def callMenu(self, category, name, menu_type, profile_key): 72 def callMenu(self, category, name, menu_type, profile_key):
69 return unicode(self.db_core_iface.callMenu(category, name, menu_type, profile_key)) 73 return unicode(self.db_core_iface.callMenu(category, name, menu_type, profile_key))
70 74
71 def confirmationAnswer(self, id, accepted, data): 75 def confirmationAnswer(self, id, accepted, data):