Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
1102:4c48e2549592 | 1103:a096b8579a3c |
---|---|
174 wx.EVT_MENU(self, idABOUT, self.onAbout) | 174 wx.EVT_MENU(self, idABOUT, self.onAbout) |
175 wx.EVT_MENU(self, idEXIT, self.onExit) | 175 wx.EVT_MENU(self, idEXIT, self.onExit) |
176 wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile) | 176 wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile) |
177 wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom) | 177 wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom) |
178 | 178 |
179 def newMessage(self, from_jid, to_jid, msg, _type, extra, profile): | 179 def newMessageHandler(self, from_jid, to_jid, msg, _type, extra, profile): |
180 QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile) | 180 QuickApp.newMessageHandler(self, from_jid, to_jid, msg, _type, extra, profile) |
181 | 181 |
182 def showAlert(self, message): | 182 def showAlert(self, message): |
183 # TODO: place this in a separate class | 183 # TODO: place this in a separate class |
184 popup=wx.PopupWindow(self) | 184 popup=wx.PopupWindow(self) |
185 ### following code come from wxpython demo | 185 ### following code come from wxpython demo |
268 dlg.ShowModal() | 268 dlg.ShowModal() |
269 dlg.Destroy() | 269 dlg.Destroy() |
270 | 270 |
271 self.bridge.launchAction(callback_id, data, profile_key, callback=action_cb, errback=action_eb) | 271 self.bridge.launchAction(callback_id, data, profile_key, callback=action_cb, errback=action_eb) |
272 | 272 |
273 def askConfirmation(self, confirmation_id, confirmation_type, data, profile): | 273 def askConfirmationHandler(self, confirmation_id, confirmation_type, data, profile): |
274 #TODO: refactor this in QuickApp | 274 #TODO: refactor this in QuickApp |
275 if not self.check_profile(profile): | 275 if not self.check_profile(profile): |
276 return | 276 return |
277 log.debug (_("Confirmation asked")) | 277 log.debug (_("Confirmation asked")) |
278 answer_data={} | 278 answer_data={} |
308 if answer==wx.ID_NO: | 308 if answer==wx.ID_NO: |
309 self.bridge.confirmationAnswer(confirmation_id, False, {}, profile) | 309 self.bridge.confirmationAnswer(confirmation_id, False, {}, profile) |
310 | 310 |
311 dlg.Destroy() | 311 dlg.Destroy() |
312 | 312 |
313 def actionResult(self, type, id, data, profile): | 313 def actionResultHandler(self, type_, id_, data, profile): |
314 if not self.check_profile(profile): | 314 if not self.check_profile(profile): |
315 return | 315 return |
316 log.debug (_("actionResult: type = [%(type)s] id = [%(id)s] data = [%(data)s]") % {'type':type, 'id':id, 'data':data}) | 316 log.debug (_("actionResult: type_ = [%(type_)s] id_ = [%(id_)s] data = [%(data)s]") % {'type_':type_, 'id_':id_, 'data':data}) |
317 if not id in self.current_action_ids: | 317 if not id_ in self.current_action_ids: |
318 log.debug (_('unknown id, ignoring')) | 318 log.debug (_('unknown id_, ignoring')) |
319 return | 319 return |
320 if type == "SUPPRESS": | 320 if type_ == "SUPPRESS": |
321 self.current_action_ids.remove(id) | 321 self.current_action_ids.remove(id_) |
322 elif type == "SUCCESS": | 322 elif type_ == "SUCCESS": |
323 self.current_action_ids.remove(id) | 323 self.current_action_ids.remove(id_) |
324 dlg = wx.MessageDialog(self, data["message"], | 324 dlg = wx.MessageDialog(self, data["message"], |
325 _('Success'), | 325 _('Success'), |
326 wx.OK | wx.ICON_INFORMATION | 326 wx.OK | wx.ICON_INFORMATION |
327 ) | 327 ) |
328 dlg.ShowModal() | 328 dlg.ShowModal() |
329 dlg.Destroy() | 329 dlg.Destroy() |
330 elif type == "ERROR": | 330 elif type_ == "ERROR": |
331 self.current_action_ids.remove(id) | 331 self.current_action_ids.remove(id_) |
332 dlg = wx.MessageDialog(self, data["message"], | 332 dlg = wx.MessageDialog(self, data["message"], |
333 _('Error'), | 333 _('Error'), |
334 wx.OK | wx.ICON_ERROR | 334 wx.OK | wx.ICON_ERROR |
335 ) | 335 ) |
336 dlg.ShowModal() | 336 dlg.ShowModal() |
337 dlg.Destroy() | 337 dlg.Destroy() |
338 elif type == "XMLUI": | 338 elif type_ == "XMLUI": |
339 self.current_action_ids.remove(id) | 339 self.current_action_ids.remove(id_) |
340 log.debug (_("XML user interface received")) | 340 log.debug (_("XML user interface received")) |
341 misc = {} | 341 misc = {} |
342 #FIXME FIXME FIXME: must clean all this crap ! | 342 #FIXME FIXME FIXME: must clean all this crap ! |
343 title = _('Form') | 343 title = _('Form') |
344 if data['type'] == _('registration'): | 344 if data['type_'] == _('registration'): |
345 title = _('Registration') | 345 title = _('Registration') |
346 misc['target'] = data['target'] | 346 misc['target'] = data['target'] |
347 misc['action_back'] = self.bridge.gatewayRegister | 347 misc['action_back'] = self.bridge.gatewayRegister |
348 XMLUI(self, title=title, xml_data = data['xml'], misc = misc) | 348 XMLUI(self, title=title, xml_data = data['xml'], misc = misc) |
349 elif type == "RESULT": | 349 elif type_ == "RESULT": |
350 self.current_action_ids.remove(id) | 350 self.current_action_ids.remove(id_) |
351 if self.current_action_ids_cb.has_key(id): | 351 if self.current_action_ids_cb.has_key(id_): |
352 callback = self.current_action_ids_cb[id] | 352 callback = self.current_action_ids_cb[id_] |
353 del self.current_action_ids_cb[id] | 353 del self.current_action_ids_cb[id_] |
354 callback(data) | 354 callback(data) |
355 elif type == "DICT_DICT": | 355 elif type_ == "DICT_DICT": |
356 self.current_action_ids.remove(id) | 356 self.current_action_ids.remove(id_) |
357 if self.current_action_ids_cb.has_key(id): | 357 if self.current_action_ids_cb.has_key(id_): |
358 callback = self.current_action_ids_cb[id] | 358 callback = self.current_action_ids_cb[id_] |
359 del self.current_action_ids_cb[id] | 359 del self.current_action_ids_cb[id_] |
360 callback(data) | 360 callback(data) |
361 else: | 361 else: |
362 log.error (_("FIXME FIXME FIXME: type [%s] not implemented") % type) | 362 log.error (_("FIXME FIXME FIXME: type_ [%s] not implemented") % type_) |
363 raise NotImplementedError | 363 raise NotImplementedError |
364 | 364 |
365 | 365 |
366 | 366 |
367 def progressCB(self, progress_id, title, message, profile): | 367 def progressCB(self, progress_id, title, message, profile): |