comparison frontends/src/wix/profile_manager.py @ 447:485a6d125498

Wix: fixed asynchronous call to get profile's data in profile manager
author Goffi <goffi@goffi.org>
date Sun, 04 Dec 2011 00:58:20 +0100
parents b1794cbb88e5
children cf005701624b
comparison
equal deleted inserted replaced
446:39a8ca1a2675 447:485a6d125498
116 self.__setDefault() 116 self.__setDefault()
117 dlg.Destroy() 117 dlg.Destroy()
118 118
119 def onProfileChange(self, event): 119 def onProfileChange(self, event):
120 """Called when a profile is choosen in the combo box""" 120 """Called when a profile is choosen in the combo box"""
121 jabberID = self.host.bridge.getParamA("JabberID", "Connection", profile_key=self.profile_name.GetValue()) 121 def setJID(jabberID):
122 password = self.host.bridge.getParamA("Password", "Connection", profile_key=self.profile_name.GetValue()) 122 self.login_jid.SetValue(jabberID)
123 self.login_jid.SetValue(jabberID) 123 def setPassword(password):
124 self.login_pass.SetValue(password) 124 self.login_pass.SetValue(password)
125 self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=self.profile_name.GetValue(), callback=setJID, errback=self.getParamError)
126 self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=self.profile_name.GetValue(), callback=setPassword, errback=self.getParamError)
125 127
126 def onConnectButton(self, event): 128 def onConnectButton(self, event):
127 """Called when the Connect button is pressed""" 129 """Called when the Connect button is pressed"""
128 name = self.profile_name.GetValue() 130 name = self.profile_name.GetValue()
129 if not name: 131 if not name:
145 if old_pass != new_pass: 147 if old_pass != new_pass:
146 debug(_('Saving new password')) 148 debug(_('Saving new password'))
147 self.host.bridge.setParam("Password", new_pass, "Connection", profile) 149 self.host.bridge.setParam("Password", new_pass, "Connection", profile)
148 self.host.plug_profile(profile) 150 self.host.plug_profile(profile)
149 151
152 def getParamError(self, ignore):
153 wx.MessageDialog(self, _("Can't get profile parameter"), _("Profile error"), wx.ICON_ERROR).ShowModal()