From 5b7b3a4b4e698179c06ce87a4bb4959d6e221ae3 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 4 Dec 2011 00:58:20 +0100 Subject: [PATCH] Wix: fixed asynchronous call to get profile's data in profile manager --- frontends/src/wix/profile_manager.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontends/src/wix/profile_manager.py b/frontends/src/wix/profile_manager.py index dea3a624..ae797401 100644 --- a/frontends/src/wix/profile_manager.py +++ b/frontends/src/wix/profile_manager.py @@ -118,10 +118,12 @@ class ProfileManager(wx.Panel): def onProfileChange(self, event): """Called when a profile is choosen in the combo box""" - jabberID = self.host.bridge.getParamA("JabberID", "Connection", profile_key=self.profile_name.GetValue()) - password = self.host.bridge.getParamA("Password", "Connection", profile_key=self.profile_name.GetValue()) - self.login_jid.SetValue(jabberID) - self.login_pass.SetValue(password) + def setJID(jabberID): + self.login_jid.SetValue(jabberID) + def setPassword(password): + self.login_pass.SetValue(password) + self.host.bridge.asyncGetParamA("JabberID", "Connection", profile_key=self.profile_name.GetValue(), callback=setJID, errback=self.getParamError) + self.host.bridge.asyncGetParamA("Password", "Connection", profile_key=self.profile_name.GetValue(), callback=setPassword, errback=self.getParamError) def onConnectButton(self, event): """Called when the Connect button is pressed""" @@ -147,3 +149,5 @@ class ProfileManager(wx.Panel): self.host.bridge.setParam("Password", new_pass, "Connection", profile) self.host.plug_profile(profile) + def getParamError(self, ignore): + wx.MessageDialog(self, _("Can't get profile parameter"), _("Profile error"), wx.ICON_ERROR).ShowModal()