Mercurial > libervia-backend
annotate frontends/src/wix/main_window.py @ 668:7bb50096d225
plugin XEP_0071: first draft
a new "xhtml" key is added in bridge newMessage's extra data when rich text is found.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 05 Nov 2013 22:41:45 +0100 |
parents | e2eff3c7ad02 |
children | 59c9a7ff903d |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
4 # wix: a SAT frontend |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi@goffi.org) |
0 | 6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
10 # (at your option) any later version. |
0 | 11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
15 # GNU Affero General Public License for more details. |
0 | 16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
0 | 19 |
20 | |
227 | 21 from sat_frontends.quick_frontend.quick_chat_list import QuickChatList |
22 from sat_frontends.quick_frontend.quick_app import QuickApp | |
0 | 23 import wx |
227 | 24 from sat_frontends.wix.contact_list import ContactList |
25 from sat_frontends.wix.chat import Chat | |
26 from sat_frontends.wix.param import Param | |
27 from sat_frontends.wix.xmlui import XMLUI | |
28 from sat_frontends.wix.gateways import GatewaysManager | |
29 from sat_frontends.wix.profile import Profile | |
30 from sat_frontends.wix.profile_manager import ProfileManager | |
0 | 31 import os.path |
225
fd9b7834d98a
distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
223
diff
changeset
|
32 from sat.tools.jid import JID |
72 | 33 from logging import debug, info, warning, error |
227 | 34 import sat_frontends.wix.constants |
0 | 35 |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
36 idCONNECT,\ |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
37 idDISCONNECT,\ |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
38 idEXIT,\ |
191 | 39 idABOUT,\ |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
40 idPARAM,\ |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
41 idADD_CONTACT,\ |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
42 idREMOVE_CONTACT,\ |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
43 idSHOW_PROFILE,\ |
72 | 44 idJOIN_ROOM,\ |
191 | 45 idFIND_GATEWAYS = range(10) |
0 | 46 |
47 class ChatList(QuickChatList): | |
48 """This class manage the list of chat windows""" | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
49 |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
50 def createChat(self, target): |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
51 return Chat(target, self.host) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
52 |
0 | 53 class MainWindow(wx.Frame, QuickApp): |
54 """main app window""" | |
55 | |
56 def __init__(self): | |
366
0806a65a5fa9
wix: updated paths to use media_dir
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
57 QuickApp.__init__(self) |
68 | 58 wx.Frame.__init__(self,None, title="SàT Wix", size=(300,500)) |
0 | 59 |
68 | 60 #sizer |
61 self.sizer = wx.BoxSizer(wx.VERTICAL) | |
62 self.SetSizer(self.sizer) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
63 |
0 | 64 #Frame elements |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
65 self.contact_list = ContactList(self, self) |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
66 self.contact_list.registerActivatedCB(self.onContactActivated) |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
67 self.contact_list.Hide() |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
68 self.sizer.Add(self.contact_list, 1, flag=wx.EXPAND) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
69 |
0 | 70 self.chat_wins=ChatList(self) |
71 self.CreateStatusBar() | |
72 | |
73 #ToolBar | |
74 self.tools=self.CreateToolBar() | |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
75 self.statusBox = wx.ComboBox(self.tools, -1, "Online", choices=[status[1] for status in const_STATUS], |
0 | 76 style=wx.CB_DROPDOWN | wx.CB_READONLY) |
77 self.tools.AddControl(self.statusBox) | |
78 self.tools.AddSeparator() | |
79 self.statusTxt=wx.TextCtrl(self.tools, -1, style = wx.TE_PROCESS_ENTER) | |
80 self.tools.AddControl(self.statusTxt) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
81 self.Bind(wx.EVT_COMBOBOX, self.onStatusChange, self.statusBox) |
0 | 82 self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt) |
83 self.tools.Disable() | |
366
0806a65a5fa9
wix: updated paths to use media_dir
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
84 |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
85 |
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
86 |
11 | 87 #tray icon |
366
0806a65a5fa9
wix: updated paths to use media_dir
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
88 ticon = wx.Icon(os.path.join(self.media_dir, 'icons/crystal/tray_icon.xpm'), wx.BITMAP_TYPE_XPM) |
11 | 89 self.tray_icon = wx.TaskBarIcon() |
70 | 90 self.tray_icon.SetIcon(ticon, _("Wix jabber client")) |
11 | 91 wx.EVT_TASKBAR_LEFT_UP(self.tray_icon, self.onTrayClick) |
92 | |
0 | 93 |
94 #events | |
95 self.Bind(wx.EVT_CLOSE, self.onClose, self) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
96 |
101 | 97 #menus |
98 self.createMenus() | |
99 for i in range(self.menuBar.GetMenuCount()): | |
100 self.menuBar.EnableTop(i, False) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
101 |
68 | 102 #profile panel |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
103 self.profile_pan = ProfileManager(self) |
68 | 104 self.sizer.Add(self.profile_pan, 1, flag=wx.EXPAND) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
105 |
119
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
106 self.postInit() |
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
107 |
0 | 108 self.Show() |
109 | |
68 | 110 def plug_profile(self, profile_key='@DEFAULT@'): |
111 """Hide profile panel then plug profile""" | |
89
23caf1051099
multi-profile/subscription misc fixes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
112 debug (_('plugin profile %s' % profile_key)) |
68 | 113 self.profile_pan.Hide() |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
114 self.contact_list.Show() |
68 | 115 self.sizer.Layout() |
116 for i in range(self.menuBar.GetMenuCount()): | |
117 self.menuBar.EnableTop(i, True) | |
118 super(MainWindow, self).plug_profile(profile_key) | |
119 | |
0 | 120 def createMenus(self): |
70 | 121 info(_("Creating menus")) |
0 | 122 connectMenu = wx.Menu() |
70 | 123 connectMenu.Append(idCONNECT, _("&Connect CTRL-c"),_(" Connect to the server")) |
124 connectMenu.Append(idDISCONNECT, _("&Disconnect CTRL-d"),_(" Disconnect from the server")) | |
125 connectMenu.Append(idPARAM,_("&Parameters"),_(" Configure the program")) | |
0 | 126 connectMenu.AppendSeparator() |
191 | 127 connectMenu.Append(idABOUT,_("A&bout"),_(" About %s") % APP_NAME) |
70 | 128 connectMenu.Append(idEXIT,_("E&xit"),_(" Terminate the program")) |
0 | 129 contactMenu = wx.Menu() |
70 | 130 contactMenu.Append(idADD_CONTACT, _("&Add contact"),_(" Add a contact to your list")) |
131 contactMenu.Append(idREMOVE_CONTACT, _("&Remove contact"),_(" Remove the selected contact from your list")) | |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
132 contactMenu.AppendSeparator() |
70 | 133 contactMenu.Append(idSHOW_PROFILE, _("&Show profile"), _(" Show contact's profile")) |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
134 communicationMenu = wx.Menu() |
72 | 135 communicationMenu.Append(idJOIN_ROOM, _("&Join Room"),_(" Join a Multi-User Chat room")) |
70 | 136 communicationMenu.Append(idFIND_GATEWAYS, _("&Find Gateways"),_(" Find gateways to legacy IM")) |
68 | 137 self.menuBar = wx.MenuBar() |
70 | 138 self.menuBar.Append(connectMenu,_("&General")) |
139 self.menuBar.Append(contactMenu,_("&Contacts")) | |
140 self.menuBar.Append(communicationMenu,_("&Communication")) | |
68 | 141 self.SetMenuBar(self.menuBar) |
0 | 142 |
101 | 143 #additionals menus |
144 #FIXME: do this in a more generic way (in quickapp) | |
145 add_menus = self.bridge.getMenus() | |
146 for menu in add_menus: | |
147 category,item,type = menu | |
148 assert(type=="NORMAL") #TODO: manage other types | |
149 menu_idx = self.menuBar.FindMenu(category) | |
150 current_menu = None | |
151 if menu_idx == wx.NOT_FOUND: | |
152 #the menu is new, we create it | |
153 current_menu = wx.Menu() | |
154 self.menuBar.Append(current_menu, category) | |
155 else: | |
156 current_menu = self.menuBar.GetMenu(menu_idx) | |
157 assert(current_menu != None) | |
158 item_id = wx.NewId() | |
159 help_string = self.bridge.getMenuHelp(category, item, type) | |
160 current_menu.Append(item_id, item, help = help_string) | |
161 #now we register the event | |
162 def event_answer(e): | |
219
782319a64ac6
primitivus, wix: added forgotten profile
Goffi <goffi@goffi.org>
parents:
204
diff
changeset
|
163 id = self.bridge.callMenu(category, item, type, self.profile) |
101 | 164 self.current_action_ids.add(id) |
165 wx.EVT_MENU(self, item_id, event_answer) | |
166 | |
167 | |
0 | 168 #events |
169 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) | |
1 | 170 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) |
0 | 171 wx.EVT_MENU(self, idPARAM, self.onParam) |
191 | 172 wx.EVT_MENU(self, idABOUT, self.onAbout) |
0 | 173 wx.EVT_MENU(self, idEXIT, self.onExit) |
174 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) | |
175 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) | |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
176 wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile) |
72 | 177 wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom) |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
178 wx.EVT_MENU(self, idFIND_GATEWAYS, self.onFindGateways) |
0 | 179 |
180 | |
513
8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
Goffi <goffi@goffi.org>
parents:
510
diff
changeset
|
181 def newMessage(self, from_jid, to_jid, msg, _type, extra, profile): |
8ee9113d307b
core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:
Goffi <goffi@goffi.org>
parents:
510
diff
changeset
|
182 QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile) |
0 | 183 |
184 def showAlert(self, message): | |
185 # TODO: place this in a separate class | |
186 popup=wx.PopupWindow(self) | |
187 ### following code come from wxpython demo | |
188 popup.SetBackgroundColour("CADET BLUE") | |
189 st = wx.StaticText(popup, -1, message, pos=(10,10)) | |
190 sz = st.GetBestSize() | |
191 popup.SetSize( (sz.width+20, sz.height+20) ) | |
192 x=(wx.DisplaySize()[0]-popup.GetSize()[0])/2 | |
193 popup.SetPosition((x,0)) | |
194 popup.Show() | |
195 wx.CallLater(5000,popup.Destroy) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
196 |
182
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
180
diff
changeset
|
197 def showDialog(self, message, title="", type="info", answer_cb = None, answer_data = None): |
0 | 198 if type == 'info': |
199 flags = wx.OK | wx.ICON_INFORMATION | |
200 elif type == 'error': | |
201 flags = wx.OK | wx.ICON_ERROR | |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
202 elif type == 'yes/no': |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
203 flags = wx.YES_NO | wx.ICON_QUESTION |
0 | 204 else: |
205 flags = wx.OK | wx.ICON_INFORMATION | |
70 | 206 error(_('unmanaged dialog type: %s'), type) |
0 | 207 dlg = wx.MessageDialog(self, message, title, flags) |
208 answer = dlg.ShowModal() | |
209 dlg.Destroy() | |
182
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
180
diff
changeset
|
210 if answer_cb: |
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
180
diff
changeset
|
211 data = [answer_data] if answer_data else [] |
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
180
diff
changeset
|
212 answer_cb(True if (answer == wx.ID_YES or answer == wx.ID_OK) else False, *data) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
213 |
0 | 214 def setStatusOnline(self, online=True): |
215 """enable/disable controls, must be called when local user online status change""" | |
216 if online: | |
217 self.SetStatusText(msgONLINE) | |
218 self.tools.Enable() | |
219 else: | |
220 self.SetStatusText(msgOFFLINE) | |
221 self.tools.Disable() | |
222 return | |
223 | |
542
3eeb6c865e4d
frontends: incoming files transfer management:
Goffi <goffi@goffi.org>
parents:
538
diff
changeset
|
224 def askConfirmation(self, confirmation_id, confirmation_type, data, profile): |
0 | 225 #TODO: refactor this in QuickApp |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
226 if not self.check_profile(profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
227 return |
70 | 228 debug (_("Confirmation asked")) |
0 | 229 answer_data={} |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
230 if confirmation_type == "FILE_TRANSFER": |
391 | 231 debug (_("File transfer confirmation asked")) |
70 | 232 dlg = wx.MessageDialog(self, _("The contact %(jid)s wants to send you the file %(filename)s\nDo you accept ?") % {'jid':data["from"], 'filename':data["filename"]}, |
233 _('File Request'), | |
0 | 234 wx.YES_NO | wx.ICON_QUESTION |
235 ) | |
236 answer=dlg.ShowModal() | |
237 if answer==wx.ID_YES: | |
70 | 238 filename = wx.FileSelector(_("Where do you want to save the file ?"), flags = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) |
0 | 239 if filename: |
240 answer_data["dest_path"] = filename | |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
241 self.bridge.confirmationAnswer(confirmation_id, True, answer_data, profile) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
242 self.waitProgress(confirmation_id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), profile) |
0 | 243 else: |
244 answer = wx.ID_NO | |
245 if answer==wx.ID_NO: | |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
246 self.bridge.confirmationAnswer(confirmation_id, False, answer_data, profile) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
247 |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
248 dlg.Destroy() |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
249 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
250 elif confirmation_type == "YES/NO": |
70 | 251 debug (_("Yes/No confirmation asked")) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
252 dlg = wx.MessageDialog(self, data["message"], |
70 | 253 _('Confirmation'), |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
254 wx.YES_NO | wx.ICON_QUESTION |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
255 ) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
256 answer=dlg.ShowModal() |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
257 if answer==wx.ID_YES: |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
258 self.bridge.confirmationAnswer(confirmation_id, True, {}, profile) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
259 if answer==wx.ID_NO: |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
260 self.bridge.confirmationAnswer(confirmation_id, False, {}, profile) |
0 | 261 |
262 dlg.Destroy() | |
263 | |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
264 def actionResult(self, type, id, data, profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
265 if not self.check_profile(profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
266 return |
70 | 267 debug (_("actionResult: type = [%(type)s] id = [%(id)s] data = [%(data)s]") % {'type':type, 'id':id, 'data':data}) |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
268 if not id in self.current_action_ids: |
70 | 269 debug (_('unknown id, ignoring')) |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
270 return |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
271 if type == "SUPPRESS": |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
272 self.current_action_ids.remove(id) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
273 elif type == "SUCCESS": |
23
925ab466c5ec
better presentation for register new account
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
274 self.current_action_ids.remove(id) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
275 dlg = wx.MessageDialog(self, data["message"], |
70 | 276 _('Success'), |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
277 wx.OK | wx.ICON_INFORMATION |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
278 ) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
279 dlg.ShowModal() |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
280 dlg.Destroy() |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
281 elif type == "ERROR": |
23
925ab466c5ec
better presentation for register new account
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
282 self.current_action_ids.remove(id) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
283 dlg = wx.MessageDialog(self, data["message"], |
70 | 284 _('Error'), |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
285 wx.OK | wx.ICON_ERROR |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
286 ) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
287 dlg.ShowModal() |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
288 dlg.Destroy() |
103 | 289 elif type == "XMLUI": |
33
b9bb5d8e0cc7
In-band-registration: data form 2 xml conversion
Goffi <goffi@goffi.org>
parents:
28
diff
changeset
|
290 self.current_action_ids.remove(id) |
103 | 291 debug (_("XML user interface received")) |
91 | 292 misc = {} |
293 #FIXME FIXME FIXME: must clean all this crap ! | |
294 title = _('Form') | |
295 if data['type'] == _('registration'): | |
103 | 296 title = _('Registration') |
91 | 297 misc['target'] = data['target'] |
298 misc['action_back'] = self.bridge.gatewayRegister | |
103 | 299 XMLUI(self, title=title, xml_data = data['xml'], misc = misc) |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
300 elif type == "RESULT": |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
301 self.current_action_ids.remove(id) |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
302 if self.current_action_ids_cb.has_key(id): |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
303 callback = self.current_action_ids_cb[id] |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
304 del self.current_action_ids_cb[id] |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
305 callback(data) |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
306 elif type == "DICT_DICT": |
28 | 307 self.current_action_ids.remove(id) |
308 if self.current_action_ids_cb.has_key(id): | |
309 callback = self.current_action_ids_cb[id] | |
310 del self.current_action_ids_cb[id] | |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
311 callback(data) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
312 else: |
70 | 313 error (_("FIXME FIXME FIXME: type [%s] not implemented") % type) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
314 raise NotImplementedError |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
315 |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
316 |
0 | 317 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
318 def progressCB(self, progress_id, title, message, profile): |
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
319 data = self.bridge.getProgress(progress_id, profile) |
0 | 320 if data: |
321 if not self.pbar: | |
322 #first answer, we must construct the bar | |
180
fdb961f27ae9
Primitivus: file sending and progress management
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
323 self.pbar = wx.ProgressDialog(title, message, float(data['size']), None, |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
324 wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME) |
180
fdb961f27ae9
Primitivus: file sending and progress management
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
325 self.pbar.finish_value = float(data['size']) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
326 |
0 | 327 self.pbar.Update(int(data['position'])) |
328 elif self.pbar: | |
329 self.pbar.Update(self.pbar.finish_value) | |
330 return | |
331 | |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
332 wx.CallLater(10, self.progressCB, progress_id, title, message, profile) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
333 |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
334 def waitProgress (self, progress_id, title, message, profile): |
0 | 335 self.pbar = None |
538
2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
Goffi <goffi@goffi.org>
parents:
513
diff
changeset
|
336 wx.CallLater(10, self.progressCB, progress_id, title, message, profile) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
337 |
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
338 |
0 | 339 |
340 ### events ### | |
341 | |
342 def onContactActivated(self, jid): | |
70 | 343 debug (_("onContactActivated: %s"), jid) |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
344 if self.chat_wins[jid.short].IsShown(): |
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
345 self.chat_wins[jid.short].Hide() |
0 | 346 else: |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
347 self.chat_wins[jid.short].Show() |
0 | 348 |
349 def onConnectRequest(self, e): | |
68 | 350 self.bridge.connect(self.profile) |
0 | 351 |
1 | 352 def onDisconnectRequest(self, e): |
68 | 353 self.bridge.disconnect(self.profile) |
1 | 354 |
0 | 355 def __updateStatus(self): |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
356 show = filter(lambda x:x[1] == self.statusBox.GetValue(), const_STATUS)[0][0] |
0 | 357 status = self.statusTxt.GetValue() |
89
23caf1051099
multi-profile/subscription misc fixes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
358 self.bridge.setPresence(show=show, statuses={'default':status}, profile_key=self.profile) #FIXME: manage multilingual statuses |
0 | 359 |
360 def onStatusChange(self, e): | |
70 | 361 debug(_("Status change request")) |
0 | 362 self.__updateStatus() |
363 | |
364 def onParam(self, e): | |
70 | 365 debug(_("Param request")) |
641
49587e170f53
core: added the security_limit to setParam
souliane <souliane@mailoo.org>
parents:
634
diff
changeset
|
366 #xmlui = self.bridge.getParamsUI(profile_key=self.profile) |
105 | 367 #XMLUI(self, xml_data = xmlui) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
368 param=Param(self) |
0 | 369 |
191 | 370 def onAbout(self, e): |
371 about = wx.AboutDialogInfo() | |
372 about.SetName(APP_NAME) | |
373 about.SetVersion (unicode(self.bridge.getVersion())) | |
572 | 374 about.SetCopyright(u"(C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson aka Goffi") |
191 | 375 about.SetDescription( _(u"%(name)s is a SàT (Salut à Toi) frontend\n"+ |
376 u"%(name)s is based on WxPython, and is the standard graphic interface of SàT") % {'name':APP_NAME}) | |
377 about.SetWebSite(("http://www.goffi.org", "Goffi's non-hebdo (french)")) | |
378 about.SetDevelopers([ "Goffi (Jérôme Poisson)"]) | |
379 try: | |
380 with open(LICENCE_PATH,"r") as licence: | |
381 about.SetLicence(''.join(licence.readlines())) | |
382 except: | |
383 pass | |
384 | |
385 wx.AboutBox(about) | |
386 | |
0 | 387 def onExit(self, e): |
388 self.Close() | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
389 |
0 | 390 def onAddContact(self, e): |
70 | 391 debug(_("Add contact request")) |
0 | 392 dlg = wx.TextEntryDialog( |
70 | 393 self, _('Please enter new contact JID'), |
394 _('Adding a contact'), _('name@server.tld')) | |
0 | 395 |
396 if dlg.ShowModal() == wx.ID_OK: | |
397 jid=JID(dlg.GetValue()) | |
398 if jid.is_valid(): | |
89
23caf1051099
multi-profile/subscription misc fixes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
399 self.bridge.addContact(jid.short, profile_key=self.profile) |
0 | 400 else: |
70 | 401 error (_("'%s' is an invalid JID !"), jid) |
0 | 402 #TODO: notice the user |
403 | |
404 dlg.Destroy() | |
405 | |
406 def onRemoveContact(self, e): | |
70 | 407 debug(_("Remove contact request")) |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
408 target = self.contact_list.getSelection() |
0 | 409 if not target: |
70 | 410 dlg = wx.MessageDialog(self, _("You haven't selected any contact !"), |
411 _('Error'), | |
0 | 412 wx.OK | wx.ICON_ERROR |
413 ) | |
414 dlg.ShowModal() | |
415 dlg.Destroy() | |
416 return | |
417 | |
70 | 418 dlg = wx.MessageDialog(self, _("Are you sure you want to delete %s from your roster list ?") % target.short, |
419 _('Contact suppression'), | |
0 | 420 wx.YES_NO | wx.ICON_QUESTION |
421 ) | |
422 | |
423 if dlg.ShowModal() == wx.ID_YES: | |
70 | 424 info(_("Unsubscribing %s presence"), target.short) |
89
23caf1051099
multi-profile/subscription misc fixes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
425 self.bridge.delContact(target.short, profile_key=self.profile) |
0 | 426 |
427 dlg.Destroy() | |
428 | |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
429 def onShowProfile(self, e): |
70 | 430 debug(_("Show contact's profile request")) |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
431 target = self.contact_list.getSelection() |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
432 if not target: |
70 | 433 dlg = wx.MessageDialog(self, _("You haven't selected any contact !"), |
434 _('Error'), | |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
435 wx.OK | wx.ICON_ERROR |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
436 ) |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
437 dlg.ShowModal() |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
438 dlg.Destroy() |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
439 return |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
440 _id = self.bridge.getCard(target.short, profile_key=self.profile) |
491
1e4731f1e1d7
wix: renamed id variable to avoid reserved name
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
441 self.current_action_ids.add(_id) |
1e4731f1e1d7
wix: renamed id variable to avoid reserved name
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
442 self.current_action_ids_cb[_id] = self.onProfileReceived |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
443 |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
444 def onProfileReceived(self, data): |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
445 """Called when a profile is received""" |
70 | 446 debug (_('Profile received: [%s]') % data) |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
447 profile=Profile(self, data) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
448 |
72 | 449 def onJoinRoom(self, e): |
450 warning('FIXME: temporary menu, must be improved') | |
80
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
451 #TODO: a proper MUC room joining dialog with nickname etc |
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
452 dlg = wx.TextEntryDialog( |
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
453 self, _("Please enter MUC's JID"), |
204 | 454 #_('Entering a MUC room'), 'test@conference.necton2.int') |
455 _('Entering a MUC room'), 'room@muc_service.server.tld') | |
80
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
456 if dlg.ShowModal() == wx.ID_OK: |
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
457 room_jid=JID(dlg.GetValue()) |
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
458 if room_jid.is_valid(): |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
391
diff
changeset
|
459 self.bridge.joinMUC(room_jid, self.profiles[self.profile]['whoami'].node, {}, self.profile) |
80
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
460 else: |
9681f18d06bd
wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
Goffi <goffi@goffi.org>
parents:
75
diff
changeset
|
461 error (_("'%s' is an invalid JID !"), room_jid) |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
462 |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
23
diff
changeset
|
463 def onFindGateways(self, e): |
70 | 464 debug(_("Find Gateways request")) |
491
1e4731f1e1d7
wix: renamed id variable to avoid reserved name
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
465 _id = self.bridge.findGateways(self.profiles[self.profile]['whoami'].domain, self.profile) |
1e4731f1e1d7
wix: renamed id variable to avoid reserved name
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
466 self.current_action_ids.add(_id) |
1e4731f1e1d7
wix: renamed id variable to avoid reserved name
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
467 self.current_action_ids_cb[_id] = self.onGatewaysFound |
28 | 468 |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
469 def onGatewaysFound(self, data): |
28 | 470 """Called when SàT has found the server gateways""" |
42
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
471 target = data['__private__']['target'] |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
472 del data['__private__'] |
874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
Goffi <goffi@goffi.org>
parents:
38
diff
changeset
|
473 gatewayManager = GatewaysManager(self, data, server=target) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
474 |
0 | 475 def onClose(self, e): |
183
9ee4a1d0d7fb
Added auto(dis)connect params + misc
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
476 QuickApp.onExit(self) |
70 | 477 info(_("Exiting...")) |
183
9ee4a1d0d7fb
Added auto(dis)connect params + misc
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
478 for win in self.chat_wins: |
9ee4a1d0d7fb
Added auto(dis)connect params + misc
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
479 self.chat_wins[win].Destroy() |
628
42ee0b0b0a15
wix: fixed application quitting (fix bug 25)
Goffi <goffi@goffi.org>
parents:
609
diff
changeset
|
480 self.tray_icon.Destroy() |
0 | 481 e.Skip() |
11 | 482 |
483 def onTrayClick(self, e): | |
70 | 484 debug(_("Tray Click")) |
11 | 485 if self.IsShown(): |
486 self.Hide() | |
487 else: | |
488 self.Show() | |
489 self.Raise() | |
490 e.Skip() | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
491 |
653
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
492 def chatStateReceived(self, from_jid_s, state, profile): |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
493 """Signal observer to display a contact chat state |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
494 @param from_jid_s: contact who sent his new state |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
495 @state: state |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
496 @profile: current profile |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
497 """ |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
498 print "TODO: chatStateReceived not implemented yet" |
e2eff3c7ad02
wix: bug fix at startup when the method chatStateReceived doesn't exist
souliane <souliane@mailoo.org>
parents:
641
diff
changeset
|
499 pass |