Mercurial > libervia-backend
comparison frontends/src/wix/main_window.py @ 807:be4c5e24dab9
plugin XEP-0077, plugin XEP-0100, frontends: gateways have been entirely implemented in backend using the new refactored XMLUI and AdvancedListContainer. The now useless code has been removed from frontends.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 18:26:03 +0100 |
parents | 9007bb133009 |
children | 1fe00f0c9a91 |
comparison
equal
deleted
inserted
replaced
806:5d6c45d6ee1b | 807:be4c5e24dab9 |
---|---|
23 from sat_frontends.quick_frontend.quick_app import QuickApp | 23 from sat_frontends.quick_frontend.quick_app import QuickApp |
24 import wx | 24 import wx |
25 from sat_frontends.wix.contact_list import ContactList | 25 from sat_frontends.wix.contact_list import ContactList |
26 from sat_frontends.wix.chat import Chat | 26 from sat_frontends.wix.chat import Chat |
27 from sat_frontends.wix.xmlui import XMLUI | 27 from sat_frontends.wix.xmlui import XMLUI |
28 from sat_frontends.wix.gateways import GatewaysManager | |
29 from sat_frontends.wix.profile import Profile | 28 from sat_frontends.wix.profile import Profile |
30 from sat_frontends.wix.profile_manager import ProfileManager | 29 from sat_frontends.wix.profile_manager import ProfileManager |
31 import os.path | 30 import os.path |
32 from sat.tools.jid import JID | 31 from sat.tools.jid import JID |
33 from logging import debug, info, warning, error | 32 from logging import debug, info, warning, error |
40 idPARAM,\ | 39 idPARAM,\ |
41 idADD_CONTACT,\ | 40 idADD_CONTACT,\ |
42 idREMOVE_CONTACT,\ | 41 idREMOVE_CONTACT,\ |
43 idSHOW_PROFILE,\ | 42 idSHOW_PROFILE,\ |
44 idJOIN_ROOM,\ | 43 idJOIN_ROOM,\ |
45 idFIND_GATEWAYS = range(10) | 44 = range(9) |
46 | 45 |
47 class ChatList(QuickChatList): | 46 class ChatList(QuickChatList): |
48 """This class manage the list of chat windows""" | 47 """This class manage the list of chat windows""" |
49 | 48 |
50 def createChat(self, target): | 49 def createChat(self, target): |
129 contactMenu.Append(idREMOVE_CONTACT, _("&Remove contact"),_(" Remove the selected contact from your list")) | 128 contactMenu.Append(idREMOVE_CONTACT, _("&Remove contact"),_(" Remove the selected contact from your list")) |
130 contactMenu.AppendSeparator() | 129 contactMenu.AppendSeparator() |
131 contactMenu.Append(idSHOW_PROFILE, _("&Show profile"), _(" Show contact's profile")) | 130 contactMenu.Append(idSHOW_PROFILE, _("&Show profile"), _(" Show contact's profile")) |
132 communicationMenu = wx.Menu() | 131 communicationMenu = wx.Menu() |
133 communicationMenu.Append(idJOIN_ROOM, _("&Join Room"),_(" Join a Multi-User Chat room")) | 132 communicationMenu.Append(idJOIN_ROOM, _("&Join Room"),_(" Join a Multi-User Chat room")) |
134 communicationMenu.Append(idFIND_GATEWAYS, _("&Find Gateways"),_(" Find gateways to legacy IM")) | |
135 self.menuBar = wx.MenuBar() | 133 self.menuBar = wx.MenuBar() |
136 self.menuBar.Append(connectMenu,_("&General")) | 134 self.menuBar.Append(connectMenu,_("&General")) |
137 self.menuBar.Append(contactMenu,_("&Contacts")) | 135 self.menuBar.Append(contactMenu,_("&Contacts")) |
138 self.menuBar.Append(communicationMenu,_("&Communication")) | 136 self.menuBar.Append(communicationMenu,_("&Communication")) |
139 self.SetMenuBar(self.menuBar) | 137 self.SetMenuBar(self.menuBar) |
174 wx.EVT_MENU(self, idEXIT, self.onExit) | 172 wx.EVT_MENU(self, idEXIT, self.onExit) |
175 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) | 173 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) |
176 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) | 174 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) |
177 wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile) | 175 wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile) |
178 wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom) | 176 wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom) |
179 wx.EVT_MENU(self, idFIND_GATEWAYS, self.onFindGateways) | |
180 | |
181 | 177 |
182 def newMessage(self, from_jid, to_jid, msg, _type, extra, profile): | 178 def newMessage(self, from_jid, to_jid, msg, _type, extra, profile): |
183 QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile) | 179 QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile) |
184 | 180 |
185 def showAlert(self, message): | 181 def showAlert(self, message): |
509 if room_jid.is_valid(): | 505 if room_jid.is_valid(): |
510 self.bridge.joinMUC(room_jid, self.profiles[self.profile]['whoami'].node, {}, self.profile) | 506 self.bridge.joinMUC(room_jid, self.profiles[self.profile]['whoami'].node, {}, self.profile) |
511 else: | 507 else: |
512 error (_("'%s' is an invalid JID !"), room_jid) | 508 error (_("'%s' is an invalid JID !"), room_jid) |
513 | 509 |
514 def onFindGateways(self, e): | |
515 debug(_("Find Gateways request")) | |
516 _id = self.bridge.findGateways(self.profiles[self.profile]['whoami'].domain, self.profile) | |
517 self.current_action_ids.add(_id) | |
518 self.current_action_ids_cb[_id] = self.onGatewaysFound | |
519 | |
520 def onGatewaysFound(self, data): | |
521 """Called when SàT has found the server gateways""" | |
522 target = data['__private__']['target'] | |
523 del data['__private__'] | |
524 gatewayManager = GatewaysManager(self, data, server=target) | |
525 | |
526 def onClose(self, e): | 510 def onClose(self, e): |
527 QuickApp.onExit(self) | 511 QuickApp.onExit(self) |
528 info(_("Exiting...")) | 512 info(_("Exiting...")) |
529 for win in self.chat_wins: | 513 for win in self.chat_wins: |
530 self.chat_wins[win].Destroy() | 514 self.chat_wins[win].Destroy() |