Mercurial > libervia-backend
comparison frontends/wix/main_window.py @ 25:53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
- test menu in Wix
- new actionResultExt method, for sending dictionary of dictionaries
- new getNextId method, for accessing sat ids from plugins.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 04 Dec 2009 08:47:44 +0100 |
parents | 925ab466c5ec |
children | c2b131e4e262 |
comparison
equal
deleted
inserted
replaced
24:61124cb82fb7 | 25:53e921c8a357 |
---|---|
39 idDISCONNECT = 2 | 39 idDISCONNECT = 2 |
40 idEXIT = 3 | 40 idEXIT = 3 |
41 idPARAM = 4 | 41 idPARAM = 4 |
42 idADD_CONTACT = 5 | 42 idADD_CONTACT = 5 |
43 idREMOVE_CONTACT = 6 | 43 idREMOVE_CONTACT = 6 |
44 idFIND_GATEWAYS = 7 | |
44 const_DEFAULT_GROUP = "Unclassed" | 45 const_DEFAULT_GROUP = "Unclassed" |
45 const_STATUS = {"Online":"", | 46 const_STATUS = {"Online":"", |
46 "Want to discuss":"chat", | 47 "Want to discuss":"chat", |
47 "AFK":"away", | 48 "AFK":"away", |
48 "Do Not Disturb":"dnd", | 49 "Do Not Disturb":"dnd", |
203 connectMenu.AppendSeparator() | 204 connectMenu.AppendSeparator() |
204 connectMenu.Append(idEXIT,"E&xit"," Terminate the program") | 205 connectMenu.Append(idEXIT,"E&xit"," Terminate the program") |
205 contactMenu = wx.Menu() | 206 contactMenu = wx.Menu() |
206 contactMenu.Append(idADD_CONTACT, "&Add contact"," Add a contact to your list") | 207 contactMenu.Append(idADD_CONTACT, "&Add contact"," Add a contact to your list") |
207 contactMenu.Append(idREMOVE_CONTACT, "&Remove contact"," Remove the selected contact from your list") | 208 contactMenu.Append(idREMOVE_CONTACT, "&Remove contact"," Remove the selected contact from your list") |
209 communicationMenu = wx.Menu() | |
210 communicationMenu.Append(idFIND_GATEWAYS, "&Find Gateways"," Find gateways to legacy IM") | |
208 menuBar = wx.MenuBar() | 211 menuBar = wx.MenuBar() |
209 menuBar.Append(connectMenu,"&General") | 212 menuBar.Append(connectMenu,"&General") |
210 menuBar.Append(contactMenu,"&Contacts") | 213 menuBar.Append(contactMenu,"&Contacts") |
214 menuBar.Append(communicationMenu,"&Communication") | |
211 self.SetMenuBar(menuBar) | 215 self.SetMenuBar(menuBar) |
212 | 216 |
213 #events | 217 #events |
214 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) | 218 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) |
215 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) | 219 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) |
216 wx.EVT_MENU(self, idPARAM, self.onParam) | 220 wx.EVT_MENU(self, idPARAM, self.onParam) |
217 wx.EVT_MENU(self, idEXIT, self.onExit) | 221 wx.EVT_MENU(self, idEXIT, self.onExit) |
218 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) | 222 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) |
219 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) | 223 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) |
224 wx.EVT_MENU(self, idFIND_GATEWAYS, self.onFindGateways) | |
220 | 225 |
221 | 226 |
222 def newMessage(self, from_jid, msg, type, to_jid): | 227 def newMessage(self, from_jid, msg, type, to_jid): |
223 QuickApp.newMessage(self, from_jid, msg, type, to_jid) | 228 QuickApp.newMessage(self, from_jid, msg, type, to_jid) |
224 | 229 |
300 self.bridge.confirmationAnswer(id, False, {}) | 305 self.bridge.confirmationAnswer(id, False, {}) |
301 | 306 |
302 dlg.Destroy() | 307 dlg.Destroy() |
303 | 308 |
304 def actionResult(self, type, id, data): | 309 def actionResult(self, type, id, data): |
305 debug ("actionResult: type = [%s] id = [%s] data =[%s]" % (type, id, data)) | 310 debug ("actionResult: type = [%s] id = [%s] data = [%s]" % (type, id, data)) |
306 if type == "SUPPRESS": | 311 if type == "SUPPRESS": |
307 self.current_action_ids.remove(id) | 312 self.current_action_ids.remove(id) |
308 elif type == "SUCCESS": | 313 elif type == "SUCCESS": |
309 self.current_action_ids.remove(id) | 314 self.current_action_ids.remove(id) |
310 dlg = wx.MessageDialog(self, data["message"], | 315 dlg = wx.MessageDialog(self, data["message"], |
319 'Error', | 324 'Error', |
320 wx.OK | wx.ICON_ERROR | 325 wx.OK | wx.ICON_ERROR |
321 ) | 326 ) |
322 dlg.ShowModal() | 327 dlg.ShowModal() |
323 dlg.Destroy() | 328 dlg.Destroy() |
329 elif type == "DICT_DICT": | |
330 print ("Dict of dict found as result") | |
324 else: | 331 else: |
325 error ("FIXME FIXME FIXME: type [%s] not implemented" % type) | 332 error ("FIXME FIXME FIXME: type [%s] not implemented" % type) |
326 raise NotImplementedError | 333 raise NotImplementedError |
327 | 334 |
328 | 335 |
419 info("Unsubsribing %s presence", target.short) | 426 info("Unsubsribing %s presence", target.short) |
420 self.bridge.delContact(target.short) | 427 self.bridge.delContact(target.short) |
421 | 428 |
422 dlg.Destroy() | 429 dlg.Destroy() |
423 | 430 |
431 def onFindGateways(self, e): | |
432 debug("Find Gateways request") | |
433 id = self.bridge.findGateways(self.whoami.domain) | |
434 print "Find Gateways id=", id | |
435 | |
424 def onClose(self, e): | 436 def onClose(self, e): |
425 info("Exiting...") | 437 info("Exiting...") |
426 e.Skip() | 438 e.Skip() |
427 | 439 |
428 def onTrayClick(self, e): | 440 def onTrayClick(self, e): |