diff frontends/src/wix/main_window.py @ 1103:a096b8579a3c

frontends: signals are managed in a more generic way
author Goffi <goffi@goffi.org>
date Mon, 11 Aug 2014 19:10:24 +0200
parents 11e2bb20e896
children e2e1e27a3680
line wrap: on
line diff
--- a/frontends/src/wix/main_window.py	Tue Jul 15 18:28:40 2014 +0200
+++ b/frontends/src/wix/main_window.py	Mon Aug 11 19:10:24 2014 +0200
@@ -176,8 +176,8 @@
         wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile)
         wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom)
 
-    def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
-        QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile)
+    def newMessageHandler(self, from_jid, to_jid, msg, _type, extra, profile):
+        QuickApp.newMessageHandler(self, from_jid, to_jid, msg, _type, extra, profile)
 
     def showAlert(self, message):
         # TODO: place this in a separate class
@@ -270,7 +270,7 @@
 
         self.bridge.launchAction(callback_id, data, profile_key, callback=action_cb, errback=action_eb)
 
-    def askConfirmation(self, confirmation_id, confirmation_type, data, profile):
+    def askConfirmationHandler(self, confirmation_id, confirmation_type, data, profile):
         #TODO: refactor this in QuickApp
         if not self.check_profile(profile):
             return
@@ -310,56 +310,56 @@
 
             dlg.Destroy()
 
-    def actionResult(self, type, id, data, profile):
+    def actionResultHandler(self, type_, id_, data, profile):
         if not self.check_profile(profile):
             return
-        log.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:
-            log.debug (_('unknown id, ignoring'))
+        log.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:
+            log.debug (_('unknown id_, ignoring'))
             return
-        if type == "SUPPRESS":
-            self.current_action_ids.remove(id)
-        elif type == "SUCCESS":
-            self.current_action_ids.remove(id)
+        if type_ == "SUPPRESS":
+            self.current_action_ids.remove(id_)
+        elif type_ == "SUCCESS":
+            self.current_action_ids.remove(id_)
             dlg = wx.MessageDialog(self, data["message"],
                                    _('Success'),
                                    wx.OK | wx.ICON_INFORMATION
                                   )
             dlg.ShowModal()
             dlg.Destroy()
-        elif type == "ERROR":
-            self.current_action_ids.remove(id)
+        elif type_ == "ERROR":
+            self.current_action_ids.remove(id_)
             dlg = wx.MessageDialog(self, data["message"],
                                    _('Error'),
                                    wx.OK | wx.ICON_ERROR
                                   )
             dlg.ShowModal()
             dlg.Destroy()
-        elif type == "XMLUI":
-            self.current_action_ids.remove(id)
+        elif type_ == "XMLUI":
+            self.current_action_ids.remove(id_)
             log.debug (_("XML user interface received"))
             misc = {}
             #FIXME FIXME FIXME: must clean all this crap !
             title = _('Form')
-            if data['type'] == _('registration'):
+            if data['type_'] == _('registration'):
                 title = _('Registration')
                 misc['target'] = data['target']
                 misc['action_back'] = self.bridge.gatewayRegister
             XMLUI(self, title=title, xml_data = data['xml'], misc = misc)
-        elif type == "RESULT":
-            self.current_action_ids.remove(id)
-            if self.current_action_ids_cb.has_key(id):
-                callback = self.current_action_ids_cb[id]
-                del self.current_action_ids_cb[id]
+        elif type_ == "RESULT":
+            self.current_action_ids.remove(id_)
+            if self.current_action_ids_cb.has_key(id_):
+                callback = self.current_action_ids_cb[id_]
+                del self.current_action_ids_cb[id_]
                 callback(data)
-        elif type == "DICT_DICT":
-            self.current_action_ids.remove(id)
-            if self.current_action_ids_cb.has_key(id):
-                callback = self.current_action_ids_cb[id]
-                del self.current_action_ids_cb[id]
+        elif type_ == "DICT_DICT":
+            self.current_action_ids.remove(id_)
+            if self.current_action_ids_cb.has_key(id_):
+                callback = self.current_action_ids_cb[id_]
+                del self.current_action_ids_cb[id_]
                 callback(data)
         else:
-            log.error (_("FIXME FIXME FIXME: type [%s] not implemented") % type)
+            log.error (_("FIXME FIXME FIXME: type_ [%s] not implemented") % type_)
             raise NotImplementedError