Mercurial > libervia-backend
changeset 135:7452ac3818e7
Core, wix: added profile management for RegisterNewAccount method, and LaunchAction
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 16 Jul 2010 20:16:13 +0800 |
parents | 7201851d9aed |
children | d6c0fe7489af |
files | frontends/wix/param.py frontends/wix/xmlui.py sat.tac sat_bridge/DBus.py |
diffstat | 4 files changed, 19 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/wix/param.py Fri Jul 16 20:15:14 2010 +0800 +++ b/frontends/wix/param.py Fri Jul 16 20:16:13 2010 +0800 @@ -74,6 +74,7 @@ sizer.Add(label) elif type=="button": ctrl = wx.Button(panel, -1, value) + ctrl.callback_id = param.getAttribute("callback_id") else: error(_("FIXME FIXME FIXME")) #FIXME ! raise NotImplementedError @@ -108,8 +109,9 @@ """Called when a paramated is modified""" self.__save_parameters() name, category = event.GetEventObject().param_id - data = {"name":name, "category":category} - id = self.host.bridge.launchAction("button", data) + callback_id = event.GetEventObject().callback_id + data = {"name":name, "category":category, "callback_id":callback_id} + id = self.host.bridge.launchAction("button", data, profile_key = self.host.profile) self.host.current_action_ids.add(id) event.Skip()
--- a/frontends/wix/xmlui.py Fri Jul 16 20:15:14 2010 +0800 +++ b/frontends/wix/xmlui.py Fri Jul 16 20:16:13 2010 +0800 @@ -199,7 +199,7 @@ else: data[field] = ctrl['control'].GetValue() - id = self.host.bridge.launchAction("button", data) + id = self.host.bridge.launchAction("button", data, profile_key = self.host.profile) self.host.current_action_ids.add(id) event.Skip()
--- a/sat.tac Fri Jul 16 20:15:14 2010 +0800 +++ b/sat.tac Fri Jul 16 20:16:13 2010 +0800 @@ -243,7 +243,6 @@ generic.FallbackHandler.__init__(self) def iqFallback(self, iq): - #pdb.set_trace() print "iqFallback: xml = [%s], handled=%s" % (iq.toXml(), "True" if iq.handled else "False") generic.FallbackHandler.iqFallback(self, iq) @@ -478,10 +477,9 @@ return next_id def registerNewAccountCB(self, id, data, profile): - #FIXME: gof: profile not managed here ! - user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0] - password = self.memory.getParamA("Password", "Connection") - server = self.memory.getParamA("Server", "Connection") + user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0] + password = self.memory.getParamA("Password", "Connection", profile_key=profile) + server = self.memory.getParamA("Server", "Connection", profile_key=profile) if not user or not password or not server: info (_('No user or server given')) @@ -490,24 +488,23 @@ return confirm_id = sat_next_id() - self.__private_data[confirm_id]=id + self.__private_data[confirm_id]=(id,profile) self.askConfirmation(confirm_id, "YES/NO", - {"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server}}, + {"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server, 'profile':profile}}, self.regisConfirmCB) print ("===============+++++++++++ REGISTER NEW ACCOUNT++++++++++++++============") print "id=",id print "data=",data def regisConfirmCB(self, id, accepted, data): - #FIXME: gof: profile not managed here ! print _("register Confirmation CB ! (%s)") % str(accepted) - action_id = self.__private_data[id] + action_id,profile = self.__private_data[id] del self.__private_data[id] - user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0] - password = self.memory.getParamA("Password", "Connection") - server = self.memory.getParamA("Server", "Connection") if accepted: + user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0] + password = self.memory.getParamA("Password", "Connection", profile_key=profile) + server = self.memory.getParamA("Server", "Connection", profile_key=profile) self.registerNewAccount(user, password, server, id=action_id) else: self.actionResult(action_id, "SUPPRESS", {}) @@ -645,7 +642,7 @@ to_jid=jid.JID(to) self.profiles[profile].roster.removeItem(to_jid) self.profiles[profile].presence.unsubscribe(to_jid) - self.host.bridge.contactDeleted(to, profile) + self.bridge.contactDeleted(to, profile) ## callbacks ##
--- a/sat_bridge/DBus.py Fri Jul 16 20:15:14 2010 +0800 +++ b/sat_bridge/DBus.py Fri Jul 16 20:16:13 2010 +0800 @@ -126,7 +126,7 @@ in_signature='s', out_signature='i') def createProfile(self, name): info ('Profile creation asked') - return self.cb["createProfile"](str(name)) + return self.cb["createProfile"](unicode(name)) @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, in_signature='s', out_signature='i') @@ -243,9 +243,9 @@ return self.cb["delContact"](entity, profile_key) @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, - in_signature='sa{ss}', out_signature='s') - def launchAction(self, type, data): - return self.cb["launchAction"](type, data) + in_signature='sa{ss}s', out_signature='s') + def launchAction(self, type, data, profile_key='@DEFAULT@'): + return self.cb["launchAction"](type, data, profile_key) @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, in_signature='sba{ss}', out_signature='')