Mercurial > libervia-backend
comparison frontends/src/primitivus/primitivus @ 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 | 5174657b3378 |
children | 1fe00f0c9a91 |
comparison
equal
deleted
inserted
replaced
806:5d6c45d6ee1b | 807:be4c5e24dab9 |
---|---|
26 from sat_frontends.quick_frontend.quick_chat_list import QuickChatList | 26 from sat_frontends.quick_frontend.quick_chat_list import QuickChatList |
27 from sat_frontends.quick_frontend.quick_utils import getNewPath, unescapePrivate | 27 from sat_frontends.quick_frontend.quick_utils import getNewPath, unescapePrivate |
28 from sat_frontends.primitivus.profile_manager import ProfileManager | 28 from sat_frontends.primitivus.profile_manager import ProfileManager |
29 from sat_frontends.primitivus.contact_list import ContactList | 29 from sat_frontends.primitivus.contact_list import ContactList |
30 from sat_frontends.primitivus.chat import Chat | 30 from sat_frontends.primitivus.chat import Chat |
31 from sat_frontends.primitivus.gateways import GatewaysManager | |
32 from sat_frontends.primitivus.xmlui import XMLUI | 31 from sat_frontends.primitivus.xmlui import XMLUI |
33 from sat_frontends.primitivus.progress import Progress | 32 from sat_frontends.primitivus.progress import Progress |
34 from sat_frontends.primitivus.notify import Notify | 33 from sat_frontends.primitivus.notify import Notify |
35 from sat_frontends.tools.misc import InputHistory | 34 from sat_frontends.tools.misc import InputHistory |
36 from sat_frontends.primitivus.constants import Const | 35 from sat_frontends.primitivus.constants import Const |
292 contact = _("Contact") | 291 contact = _("Contact") |
293 menu.addMenu(contact, _("Add contact"), self.onAddContactRequest) | 292 menu.addMenu(contact, _("Add contact"), self.onAddContactRequest) |
294 menu.addMenu(contact, _("Remove contact"), self.onRemoveContactRequest) | 293 menu.addMenu(contact, _("Remove contact"), self.onRemoveContactRequest) |
295 communication = _("Communication") | 294 communication = _("Communication") |
296 menu.addMenu(communication, _("Join room"), self.onJoinRoomRequest, 'meta j') | 295 menu.addMenu(communication, _("Join room"), self.onJoinRoomRequest, 'meta j') |
297 menu.addMenu(communication, _("Find Gateways"), self.onFindGatewaysRequest, 'meta g') | |
298 #additionals menus | 296 #additionals menus |
299 #FIXME: do this in a more generic way (in quickapp) | 297 #FIXME: do this in a more generic way (in quickapp) |
300 add_menus = self.bridge.getMenus('', Const.NO_SECURITY_LIMIT) | 298 add_menus = self.bridge.getMenus('', Const.NO_SECURITY_LIMIT) |
301 def add_menu_cb(callback_id): | 299 def add_menu_cb(callback_id): |
302 self.launchAction(callback_id, None, profile_key = self.profile) | 300 self.launchAction(callback_id, None, profile_key = self.profile) |
494 elif confirmation_type == "YES/NO": | 492 elif confirmation_type == "YES/NO": |
495 pop_up_widget = sat_widgets.ConfirmDialog(data["message"], no_cb=refuse_cb, yes_cb=accept_cb) | 493 pop_up_widget = sat_widgets.ConfirmDialog(data["message"], no_cb=refuse_cb, yes_cb=accept_cb) |
496 self.showPopUp(pop_up_widget) | 494 self.showPopUp(pop_up_widget) |
497 | 495 |
498 def actionResult(self, type, id, data, profile): | 496 def actionResult(self, type, id, data, profile): |
497 # FIXME: to be removed | |
499 if not self.check_profile(profile): | 498 if not self.check_profile(profile): |
500 return | 499 return |
501 | 500 |
502 if not id in self.current_action_ids: | 501 if not id in self.current_action_ids: |
503 debug (_('unknown id, ignoring')) | 502 debug (_('unknown id, ignoring')) |
586 def onJoinRoomRequest(self, menu): | 585 def onJoinRoomRequest(self, menu): |
587 """User wants to join a MUC room""" | 586 """User wants to join a MUC room""" |
588 pop_up_widget = sat_widgets.InputDialog(_("Entering a MUC room"), _("Please enter MUC's JID"), default_txt = 'room@muc_service.server.tld', cancel_cb=self.removePopUp, ok_cb=self.onJoinRoom) | 587 pop_up_widget = sat_widgets.InputDialog(_("Entering a MUC room"), _("Please enter MUC's JID"), default_txt = 'room@muc_service.server.tld', cancel_cb=self.removePopUp, ok_cb=self.onJoinRoom) |
589 self.showPopUp(pop_up_widget) | 588 self.showPopUp(pop_up_widget) |
590 | 589 |
591 def onFindGatewaysRequest(self, e): | |
592 debug(_("Find gateways request")) | |
593 id = self.bridge.findGateways(self.profiles[self.profile]['whoami'].domain, self.profile) | |
594 self.current_action_ids.add(id) | |
595 self.current_action_ids_cb[id] = self.onGatewaysFound | |
596 | |
597 def onAddContactRequest(self, menu): | 590 def onAddContactRequest(self, menu): |
598 pop_up_widget = sat_widgets.InputDialog(_("Adding a contact"), _("Please enter new contact JID"), default_txt = 'name@server.tld', cancel_cb=self.removePopUp, ok_cb=self.onAddContact) | 591 pop_up_widget = sat_widgets.InputDialog(_("Adding a contact"), _("Please enter new contact JID"), default_txt = 'name@server.tld', cancel_cb=self.removePopUp, ok_cb=self.onAddContact) |
599 self.showPopUp(pop_up_widget) | 592 self.showPopUp(pop_up_widget) |
600 | 593 |
601 def onRemoveContactRequest(self, menu): | 594 def onRemoveContactRequest(self, menu): |
608 | 601 |
609 def onAboutRequest(self, menu): | 602 def onAboutRequest(self, menu): |
610 self.showPopUp(sat_widgets.Alert(_("About"), Const.APP_NAME + " v" + self.bridge.getVersion(), ok_cb=self.removePopUp)) | 603 self.showPopUp(sat_widgets.Alert(_("About"), Const.APP_NAME + " v" + self.bridge.getVersion(), ok_cb=self.removePopUp)) |
611 | 604 |
612 #MISC CALLBACKS# | 605 #MISC CALLBACKS# |
613 | |
614 def onGatewaysFound(self, data): | |
615 """Called when SàT has found the server gateways""" | |
616 target = data['__private__']['target'] | |
617 del data['__private__'] | |
618 gatewayManager = GatewaysManager(self, data, server=target) | |
619 self.addWindow(gatewayManager) | |
620 | 606 |
621 def chatStateReceived(self, from_jid_s, state, profile): | 607 def chatStateReceived(self, from_jid_s, state, profile): |
622 """Signal observer to display a contact chat state | 608 """Signal observer to display a contact chat state |
623 @param from_jid_s: contact who sent his new state | 609 @param from_jid_s: contact who sent his new state |
624 @state: state | 610 @state: state |