backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred
- getParams, getParamsForCategory and getParamsUI are now asynchronous primitivus: management of asynchronous getParamsUI
This commit is contained in:
parent
8ac5759a5f
commit
19232e8a6b
3 changed files with 250 additions and 166 deletions
|
|
@ -111,17 +111,17 @@ class DBusBridgeFrontend(BridgeFrontend):
|
|||
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
|
||||
return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key))
|
||||
|
||||
def getParams(self, profile_key="@DEFAULT@"):
|
||||
return unicode(self.db_core_iface.getParams(profile_key))
|
||||
def getParams(self, profile_key="@DEFAULT@", callback=None, errback=None):
|
||||
return unicode(self.db_core_iface.getParams(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
|
||||
|
||||
def getParamsCategories(self, ):
|
||||
return self.db_core_iface.getParamsCategories()
|
||||
|
||||
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
||||
return unicode(self.db_core_iface.getParamsForCategory(category, profile_key))
|
||||
def getParamsForCategory(self, category, profile_key="@DEFAULT@", callback=None, errback=None):
|
||||
return unicode(self.db_core_iface.getParamsForCategory(category, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
|
||||
|
||||
def getParamsUI(self, profile_key="@DEFAULT@"):
|
||||
return unicode(self.db_core_iface.getParamsUI(profile_key))
|
||||
def getParamsUI(self, profile_key="@DEFAULT@", callback=None, errback=None):
|
||||
return unicode(self.db_core_iface.getParamsUI(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
|
||||
|
||||
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
||||
return self.db_core_iface.getPresenceStatus(profile_key)
|
||||
|
|
|
|||
|
|
@ -468,8 +468,12 @@ class PrimitivusApp(QuickApp):
|
|||
self.bridge.disconnect(self.profile)
|
||||
|
||||
def onParam(self, menu):
|
||||
params = XMLUI(self,xml_data=self.bridge.getParamsUI(self.profile))
|
||||
self.addWindow(params)
|
||||
def success(params):
|
||||
self.addWindow(XMLUI(self,xml_data=params))
|
||||
def failure(error):
|
||||
self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters"), ok_cb=self.removePopUp))
|
||||
self.bridge.getParamsUI(self.profile, callback=success, errback=failure)
|
||||
|
||||
|
||||
def onExitRequest(self, menu):
|
||||
QuickApp.onExit(self)
|
||||
|
|
|
|||
|
|
@ -148,5 +148,6 @@ class ProfileManager(urwid.WidgetWrap):
|
|||
self.host.bridge.setParam("Password", new_pass, "Connection", profile)
|
||||
self.host.plug_profile(profile)
|
||||
|
||||
def getParamError(self):
|
||||
error(_("Can't get profile parameter"))
|
||||
def getParamError(self, ignore):
|
||||
popup = Alert("Error", _("Can't get profile parameter"), ok_cb=self.host.removePopUp)
|
||||
self.host.showPopUp(popup)
|
||||
|
|
|
|||
Loading…
Reference in a new issue