comparison frontends/src/wix/profile_manager.py @ 552:6970ab58b020

wix: fixed profile manager
author Goffi <goffi@goffi.org>
date Sat, 24 Nov 2012 02:21:02 +0100
parents 2a072735e459
children ca13633d3b6b
comparison
equal deleted inserted replaced
551:dcec4ba8e72c 552:6970ab58b020
134 if name[0]=='@': 134 if name[0]=='@':
135 wx.MessageDialog(self, _("A profile name can't start with a @"), _("Bad profile name"), wx.ICON_ERROR).ShowModal() 135 wx.MessageDialog(self, _("A profile name can't start with a @"), _("Bad profile name"), wx.ICON_ERROR).ShowModal()
136 return 136 return
137 profile = self.host.bridge.getProfileName(name) 137 profile = self.host.bridge.getProfileName(name)
138 assert(profile) 138 assert(profile)
139 old_jid = self.host.bridge.getParamA("JabberID", "Connection", profile_key=profile) 139
140 old_pass = self.host.bridge.getParamA("Password", "Connection", profile_key=profile) 140 self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=profile, callback=lambda old_jid: self.__old_jidReceived(old_jid, profile), errback=self.getParamError)
141
142 def __old_jidReceived(self, old_jid, profile):
143 self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=profile, callback=lambda old_pass: self.__old_passReceived(old_jid, old_pass, profile), errback=self.getParamError)
144
145 def __old_passReceived(self, old_jid, old_pass, profile):
141 new_jid = self.login_jid.GetValue() 146 new_jid = self.login_jid.GetValue()
142 new_pass = self.login_pass.GetValue() 147 new_pass = self.login_pass.GetValue()
143 if old_jid != new_jid: 148 if old_jid != new_jid:
144 debug(_('Saving new JID and server')) 149 debug(_('Saving new JID and server'))
145 self.host.bridge.setParam("JabberID", new_jid, "Connection", profile) 150 self.host.bridge.setParam("JabberID", new_jid, "Connection", profile)
147 if old_pass != new_pass: 152 if old_pass != new_pass:
148 debug(_('Saving new password')) 153 debug(_('Saving new password'))
149 self.host.bridge.setParam("Password", new_pass, "Connection", profile) 154 self.host.bridge.setParam("Password", new_pass, "Connection", profile)
150 self.host.plug_profile(profile) 155 self.host.plug_profile(profile)
151 156
157
152 def getParamError(self, ignore): 158 def getParamError(self, ignore):
153 wx.MessageDialog(self, _("Can't get profile parameter"), _("Profile error"), wx.ICON_ERROR).ShowModal() 159 wx.MessageDialog(self, _("Can't get profile parameter"), _("Profile error"), wx.ICON_ERROR).ShowModal()