diff frontends/src/wix/profile_manager.py @ 893:308a96bc7c1b

core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile
author souliane <souliane@mailoo.org>
date Mon, 03 Mar 2014 09:59:10 +0100
parents 1fe00f0c9a91
children 5a6354ff468c
line wrap: on
line diff
--- a/frontends/src/wix/profile_manager.py	Fri Feb 28 11:19:08 2014 +0100
+++ b/frontends/src/wix/profile_manager.py	Mon Mar 03 09:59:10 2014 +0100
@@ -21,10 +21,8 @@
 
 from sat.core.i18n import _
 import wx
-import pdb
 from logging import debug, info, error
 from sat.tools.jid  import JID
-import pdb
 
 
 class ProfileManager(wx.Panel):
@@ -99,9 +97,10 @@
                 if name[0]=='@':
                     wx.MessageDialog(self, _("A profile name can't start with a @"), _("Bad profile name"), wx.ICON_ERROR).ShowModal()
                 else:
-                    profile = self.host.bridge.createProfile(name)
-                    self.__refillProfiles()
-                    self.profile_name.SetValue(name)
+                    def cb():
+                        self.__refillProfiles()
+                        self.profile_name.SetValue(name)
+                    self.host.bridge.asyncCreateProfile(name, callback=cb)
         dlg.Destroy()
 
     def onDeleteProfile(self, event):
@@ -110,9 +109,10 @@
             return
         dlg = wx.MessageDialog(self, _("Are you sure to delete the profile [%s]") % name, _("Confirmation"), wx.ICON_QUESTION | wx.YES_NO)
         if dlg.ShowModal() == wx.ID_YES:
-            self.host.bridge.deleteProfile(name)
-            self.__refillProfiles()
-            self.__setDefault()
+            def cb():
+                self.__refillProfiles()
+                self.__setDefault()
+            self.host.bridge.asyncDeleteProfile(name, callback=cb)
         dlg.Destroy()
 
     def onProfileChange(self, event):