diff frontends/src/wix/main_window.py @ 538:2c4016921403

core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles - added profile argument to askConfirmation, actionResult, actionResultExt, entityDataUpdated, confirmationAnswer, getProgress - core, frontends: fixed calls/signals according to new bridge API - user of proper profile namespace for progression indicators and dialogs - memory: getParam* now return bool when param type is bool - memory: added getStringParam* to return string instead of typed value - core, memory, storage, quick_frontend: getHistory now manage properly multi-profiles - plugins XEP-0047, XEP-0054, XEP-0065, XEP-0077, XEP-0096; multi-profiles proper handling
author Goffi <goffi@goffi.org>
date Sat, 10 Nov 2012 16:38:16 +0100
parents 8ee9113d307b
children 3eeb6c865e4d
line wrap: on
line diff
--- a/frontends/src/wix/main_window.py	Sun Nov 04 23:53:26 2012 +0100
+++ b/frontends/src/wix/main_window.py	Sat Nov 10 16:38:16 2012 +0100
@@ -223,11 +223,13 @@
             self.tools.Disable()
         return
 
-    def askConfirmation(self, type, id, data):
+    def askConfirmation(self, confirmation_type, confirmation_id, data, profile):
         #TODO: refactor this in QuickApp
+        if not self.check_profile(profile):
+            return
         debug (_("Confirmation asked"))
         answer_data={}
-        if type == "FILE_TRANSFER":
+        if confirmation_type == "FILE_TRANSFER":
             debug (_("File transfer confirmation asked"))
             dlg = wx.MessageDialog(self, _("The contact %(jid)s wants to send you the file %(filename)s\nDo you accept ?") % {'jid':data["from"], 'filename':data["filename"]},
                                    _('File Request'),
@@ -238,16 +240,16 @@
                 filename = wx.FileSelector(_("Where do you want to save the file ?"), flags = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
                 if filename:
                     answer_data["dest_path"] = filename
-                    self.bridge.confirmationAnswer(id, True, answer_data)
-                    self.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename)) 
+                    self.bridge.confirmationAnswer(confirmation_id, True, answer_data, profile)
+                    self.waitProgress(confirmation_id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), profile) 
                 else:
                     answer = wx.ID_NO
             if answer==wx.ID_NO:
-                    self.bridge.confirmationAnswer(id, False, answer_data)
+                    self.bridge.confirmationAnswer(confirmation_id, False, answer_data, profile)
             
             dlg.Destroy()
 
-        elif type == "YES/NO":
+        elif confirmation_type == "YES/NO":
             debug (_("Yes/No confirmation asked"))
             dlg = wx.MessageDialog(self, data["message"],
                                    _('Confirmation'),
@@ -255,13 +257,15 @@
                                   )
             answer=dlg.ShowModal()
             if answer==wx.ID_YES:
-                self.bridge.confirmationAnswer(id, True, {})
+                self.bridge.confirmationAnswer(confirmation_id, True, {}, profile)
             if answer==wx.ID_NO:
-                self.bridge.confirmationAnswer(id, False, {})
+                self.bridge.confirmationAnswer(confirmation_id, False, {}, profile)
 
             dlg.Destroy()
 
-    def actionResult(self, type, id, data):
+    def actionResult(self, type, id, data, profile):
+        if not self.check_profile(profile):
+            return
         debug (_("actionResult: type = [%(type)s] id = [%(id)s] data = [%(data)s]") % {'type':type, 'id':id, 'data':data})
         if not id in self.current_action_ids:
             debug (_('unknown id, ignoring'))
@@ -313,8 +317,8 @@
 
 
 
-    def progressCB(self, id, title, message):
-        data = self.bridge.getProgress(id)
+    def progressCB(self, progress_id, title, message, profile):
+        data = self.bridge.getProgress(progress_id, profile)
         if data:
             if not self.pbar:
                 #first answer, we must construct the bar
@@ -327,11 +331,11 @@
             self.pbar.Update(self.pbar.finish_value)
             return
 
-        wx.CallLater(10, self.progressCB, id, title, message)
+        wx.CallLater(10, self.progressCB, progress_id, title, message, profile)
         
-    def waitProgress (self, id, title, message):
+    def waitProgress (self, progress_id, title, message, profile):
         self.pbar = None
-        wx.CallLater(10, self.progressCB, id, title, message)
+        wx.CallLater(10, self.progressCB, progress_id, title, message, profile)