Mercurial > libervia-backend
annotate frontends/wix/main_window.py @ 24:61124cb82fb7
Updated README and licenses (for images), added installation instructions.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Dec 2009 07:55:46 +0100 |
parents | 925ab466c5ec |
children | 53e921c8a357 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 wix: a SAT frontend | |
6 Copyright (C) 2009 Jérôme Poisson (goffi@goffi.org) | |
7 | |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation, either version 3 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 """ | |
21 | |
22 | |
23 import wx | |
24 from chat import Chat | |
25 from param import Param | |
26 import gobject | |
27 import os.path | |
28 import pdb | |
29 from tools.jid import JID | |
30 from logging import debug, info, error | |
31 from quick_frontend.quick_chat_list import QuickChatList | |
32 from quick_frontend.quick_contact_list import QuickContactList | |
33 from quick_frontend.quick_app import QuickApp | |
34 | |
35 | |
36 msgOFFLINE = "offline" | |
37 msgONLINE = "online" | |
38 idCONNECT = 1 | |
1 | 39 idDISCONNECT = 2 |
40 idEXIT = 3 | |
41 idPARAM = 4 | |
42 idADD_CONTACT = 5 | |
43 idREMOVE_CONTACT = 6 | |
0 | 44 const_DEFAULT_GROUP = "Unclassed" |
45 const_STATUS = {"Online":"", | |
46 "Want to discuss":"chat", | |
47 "AFK":"away", | |
48 "Do Not Disturb":"dnd", | |
49 "Away":"xa"} | |
50 | |
51 class ChatList(QuickChatList): | |
52 """This class manage the list of chat windows""" | |
53 | |
54 def __init__(self, host): | |
55 QuickChatList.__init__(self, host) | |
56 | |
57 def createChat(self, name): | |
58 return Chat(name, self.host) | |
59 | |
60 | |
61 | |
62 class ContactList(wx.TreeCtrl, QuickContactList): | |
63 """Customized control to manage contacts.""" | |
64 | |
65 def __init__(self, parent): | |
66 wx.TreeCtrl.__init__(self, parent, style = wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS) | |
67 QuickContactList.__init__(self) | |
68 self.jid_ids={} | |
69 self.groups={} | |
70 self.root=self.AddRoot("") | |
71 self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onActivated, self) | |
72 | |
73 #icons | |
74 isz = (16,16) | |
75 il = wx.ImageList(isz[0], isz[1]) | |
76 self.icon_online = il.Add(wx.ArtProvider_GetBitmap(wx.ART_TICK_MARK, wx.ART_OTHER, isz)) | |
77 self.icon_unavailable = il.Add(wx.ArtProvider_GetBitmap(wx.ART_CROSS_MARK, wx.ART_OTHER, isz)) | |
78 self.AssignImageList(il) | |
79 | |
80 self.__addNode(const_DEFAULT_GROUP) | |
81 | |
82 def __addNode(self, label): | |
83 """Add an item container""" | |
84 ret=self.AppendItem(self.root, label) | |
85 self.SetPyData(ret, "[node]") | |
86 self.SetItemBold(ret) | |
87 self.groups[label]=ret | |
88 | |
89 def replace(self, jid, name="", show="", status="", group=""): | |
90 debug("status = %s show = %s",status, show) | |
91 if not self.jid_ids.has_key(jid): | |
92 self.add(jid, name, show, status, group) | |
93 else: | |
94 debug ("updating %s",jid) | |
95 self.__presentItem(jid, name, show, status, group) | |
96 | |
97 def __presentItem(self, jid, name, show, status, group): | |
98 """Make a nice presentation of the contact in the list.""" | |
99 id=self.jid_ids[jid] | |
100 label= "%s [%s] \n %s" % ((name or jid), (show or "online"), status) | |
101 self.SetItemText(id, label) | |
102 | |
103 # icon | |
104 if not show or show=="chat": | |
105 self.SetItemImage(id, self.icon_online) | |
106 else: | |
107 self.SetItemImage(id, self.icon_unavailable) | |
108 | |
109 #colour | |
110 if not show: | |
111 self.SetItemTextColour(id, wx.BLACK) | |
112 elif show=="chat": | |
113 self.SetItemTextColour(id, wx.GREEN) | |
114 elif show=="away": | |
115 self.SetItemTextColour(id, wx.BLUE) | |
116 else: | |
117 self.SetItemTextColour(id, wx.RED) | |
118 | |
119 def add(self, jid, name="", show="", status="", group=""): | |
120 """add a contact to the list""" | |
121 debug ("adding %s",jid) | |
122 dest_group=group or const_DEFAULT_GROUP | |
123 if not self.groups.has_key(dest_group): | |
124 self.__addNode(dest_group) | |
125 self.jid_ids[jid]=self.AppendItem(self.groups[dest_group], "") | |
126 self.__presentItem(jid, name, show, status, group) | |
127 self.SetPyData(self.jid_ids[jid], "[contact]"+jid) | |
128 self.EnsureVisible(self.jid_ids[jid]) | |
129 self.Refresh() #FIXME: Best way ? | |
130 | |
131 def remove(self, jid): | |
132 """remove a contact from the list""" | |
133 debug ("removing %s",jid) | |
134 self.Delete(self.jid_ids[jid]) | |
135 del self.jid_ids[jid] | |
136 self.Refresh() #FIXME: Best way ? | |
137 | |
138 def onActivated(self, event): | |
139 """Called when a contact is clicked or activated with keyboard.""" | |
140 if self.GetPyData(event.GetItem()).startswith("[contact]"): | |
141 self.onActivatedCB(self.GetPyData(event.GetItem())[9:]) | |
142 else: | |
143 event.Skip() | |
144 | |
145 def getSelection(self): | |
146 """Return the selected contact, or an empty string if there is not""" | |
147 data = self.GetPyData(self.GetSelection()) | |
148 if not data or not data.startswith("[contact]"): | |
149 return "" | |
150 return JID(data[9:]) | |
151 | |
152 def registerActivatedCB(self, cb): | |
153 """Register a callback with manage contact activation.""" | |
154 self.onActivatedCB=cb | |
155 | |
156 class MainWindow(wx.Frame, QuickApp): | |
157 """main app window""" | |
158 | |
159 def __init__(self): | |
160 wx.Frame.__init__(self,None, title="SAT Wix", size=(400,200)) | |
161 | |
162 | |
163 #Frame elements | |
164 self.contactList = ContactList(self) | |
165 self.contactList.registerActivatedCB(self.onContactActivated) | |
166 self.chat_wins=ChatList(self) | |
167 self.CreateStatusBar() | |
168 self.SetStatusText(msgOFFLINE) | |
169 self.createMenus() | |
170 | |
171 #ToolBar | |
172 self.tools=self.CreateToolBar() | |
173 self.statusBox = wx.ComboBox(self.tools, -1, "Online", choices=const_STATUS.keys(), | |
174 style=wx.CB_DROPDOWN | wx.CB_READONLY) | |
175 self.tools.AddControl(self.statusBox) | |
176 self.tools.AddSeparator() | |
177 self.statusTxt=wx.TextCtrl(self.tools, -1, style = wx.TE_PROCESS_ENTER) | |
178 self.tools.AddControl(self.statusTxt) | |
179 self.Bind(wx.EVT_COMBOBOX, self.onStatusChange, self.statusBox) | |
180 self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt) | |
181 self.tools.Disable() | |
11 | 182 |
183 #tray icon | |
184 ticon = wx.Icon("images/tray_icon.xpm", wx.BITMAP_TYPE_XPM) | |
185 self.tray_icon = wx.TaskBarIcon() | |
186 self.tray_icon.SetIcon(ticon, "Wix jabber client") | |
187 wx.EVT_TASKBAR_LEFT_UP(self.tray_icon, self.onTrayClick) | |
188 | |
0 | 189 |
190 #events | |
191 self.Bind(wx.EVT_CLOSE, self.onClose, self) | |
192 | |
193 QuickApp.__init__(self) | |
194 | |
195 self.Show() | |
196 | |
197 def createMenus(self): | |
198 info("Creating menus") | |
199 connectMenu = wx.Menu() | |
200 connectMenu.Append(idCONNECT, "&Connect CTRL-c"," Connect to the server") | |
1 | 201 connectMenu.Append(idDISCONNECT, "&Disconnect CTRL-d"," Disconnect from the server") |
0 | 202 connectMenu.Append(idPARAM,"&Parameters"," Configure the program") |
203 connectMenu.AppendSeparator() | |
204 connectMenu.Append(idEXIT,"E&xit"," Terminate the program") | |
205 contactMenu = wx.Menu() | |
206 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 menuBar = wx.MenuBar() | |
209 menuBar.Append(connectMenu,"&General") | |
210 menuBar.Append(contactMenu,"&Contacts") | |
211 self.SetMenuBar(menuBar) | |
212 | |
213 #events | |
214 wx.EVT_MENU(self, idCONNECT, self.onConnectRequest) | |
1 | 215 wx.EVT_MENU(self, idDISCONNECT, self.onDisconnectRequest) |
0 | 216 wx.EVT_MENU(self, idPARAM, self.onParam) |
217 wx.EVT_MENU(self, idEXIT, self.onExit) | |
218 wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact) | |
219 wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact) | |
220 | |
221 | |
222 def newMessage(self, from_jid, msg, type, to_jid): | |
223 QuickApp.newMessage(self, from_jid, msg, type, to_jid) | |
224 | |
225 def showAlert(self, message): | |
226 # TODO: place this in a separate class | |
227 popup=wx.PopupWindow(self) | |
228 ### following code come from wxpython demo | |
229 popup.SetBackgroundColour("CADET BLUE") | |
230 st = wx.StaticText(popup, -1, message, pos=(10,10)) | |
231 sz = st.GetBestSize() | |
232 popup.SetSize( (sz.width+20, sz.height+20) ) | |
233 x=(wx.DisplaySize()[0]-popup.GetSize()[0])/2 | |
234 popup.SetPosition((x,0)) | |
235 popup.Show() | |
236 wx.CallLater(5000,popup.Destroy) | |
237 | |
238 def showDialog(self, message, title="", type="info"): | |
239 if type == 'info': | |
240 flags = wx.OK | wx.ICON_INFORMATION | |
241 elif type == 'error': | |
242 flags = wx.OK | wx.ICON_ERROR | |
243 elif type == 'question': | |
244 flags = wx.OK | wx.ICON_QUESTION | |
245 else: | |
246 flags = wx.OK | wx.ICON_INFORMATION | |
247 dlg = wx.MessageDialog(self, message, title, flags) | |
248 answer = dlg.ShowModal() | |
249 dlg.Destroy() | |
250 return True if (answer == wx.ID_YES or answer == wx.ID_OK) else False | |
251 | |
252 def setStatusOnline(self, online=True): | |
253 """enable/disable controls, must be called when local user online status change""" | |
254 if online: | |
255 self.SetStatusText(msgONLINE) | |
256 self.tools.Enable() | |
257 else: | |
258 self.SetStatusText(msgOFFLINE) | |
259 self.tools.Disable() | |
260 return | |
261 | |
262 | |
263 def presenceUpdate(self, jabber_id, type, show, status, priority): | |
264 QuickApp.presenceUpdate(self, jabber_id, type, show, status, priority) | |
265 | |
266 def askConfirmation(self, type, id, data): | |
267 #TODO: refactor this in QuickApp | |
268 debug ("Confirmation asked") | |
269 answer_data={} | |
270 if type == "FILE_TRANSFERT": | |
271 debug ("File transfert confirmation asked") | |
272 dlg = wx.MessageDialog(self, "The contact %s wants to send you the file %s\nDo you accept ?" % (data["from"], data["filename"]), | |
273 'File Request', | |
274 wx.YES_NO | wx.ICON_QUESTION | |
275 ) | |
276 answer=dlg.ShowModal() | |
277 if answer==wx.ID_YES: | |
278 filename = wx.FileSelector("Where do you want to save the file ?", flags = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) | |
279 if filename: | |
280 answer_data["dest_path"] = filename | |
281 self.bridge.confirmationAnswer(id, True, answer_data) | |
282 self.waitProgress(id, "File Transfer", "Copying %s" % os.path.basename(filename)) | |
283 else: | |
284 answer = wx.ID_NO | |
285 if answer==wx.ID_NO: | |
286 self.bridge.confirmationAnswer(id, False, answer_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
|
287 |
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() |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
289 |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
290 elif type == "YES/NO": |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
291 debug ("Yes/No confirmation asked") |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
292 dlg = wx.MessageDialog(self, data["message"], |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
293 'Confirmation', |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
294 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
|
295 ) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
296 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
|
297 if answer==wx.ID_YES: |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
298 self.bridge.confirmationAnswer(id, True, {}) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
299 if answer==wx.ID_NO: |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
300 self.bridge.confirmationAnswer(id, False, {}) |
0 | 301 |
302 dlg.Destroy() | |
303 | |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
304 def actionResult(self, type, id, data): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
305 debug ("actionResult: type = [%s] id = [%s] data =[%s]" % (type, id, data)) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
306 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
|
307 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
|
308 elif type == "SUCCESS": |
23
925ab466c5ec
better presentation for register new account
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
309 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
|
310 dlg = wx.MessageDialog(self, data["message"], |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
311 'Success', |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
312 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
|
313 ) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
314 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
|
315 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
|
316 elif type == "ERROR": |
23
925ab466c5ec
better presentation for register new account
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
317 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
|
318 dlg = wx.MessageDialog(self, data["message"], |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
319 'Error', |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
320 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
|
321 ) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
322 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
|
323 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
|
324 else: |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
325 error ("FIXME FIXME FIXME: type [%s] not implemented" % type) |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
326 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
|
327 |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
328 |
0 | 329 |
330 def progressCB(self, id, title, message): | |
331 data = self.bridge.getProgress(id) | |
332 if data: | |
333 if not data['position']: | |
334 data['position'] = '0' | |
335 if not self.pbar: | |
336 #first answer, we must construct the bar | |
337 self.pbar = wx.ProgressDialog(title, message, int(data['size']), None, | |
338 wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME) | |
339 self.pbar.finish_value = int(data['size']) | |
340 | |
341 self.pbar.Update(int(data['position'])) | |
342 elif self.pbar: | |
343 self.pbar.Update(self.pbar.finish_value) | |
344 return | |
345 | |
346 wx.CallLater(10, self.progressCB, id, title, message) | |
347 | |
348 def waitProgress (self, id, title, message): | |
349 self.pbar = None | |
350 wx.CallLater(10, self.progressCB, id, title, message) | |
351 | |
352 | |
353 | |
354 ### events ### | |
355 | |
356 def onContactActivated(self, jid): | |
357 debug ("onContactActivated: %s", jid) | |
358 if self.chat_wins[jid].IsShown(): | |
359 self.chat_wins[jid].Hide() | |
360 else: | |
361 self.chat_wins[jid].Show() | |
362 | |
363 def onConnectRequest(self, e): | |
364 self.bridge.connect() | |
365 | |
1 | 366 def onDisconnectRequest(self, e): |
367 self.bridge.disconnect() | |
368 | |
0 | 369 def __updateStatus(self): |
370 show = const_STATUS[self.statusBox.GetValue()] | |
371 status = self.statusTxt.GetValue() | |
372 self.bridge.setPresence(show=show, status=status) | |
373 | |
374 def onStatusChange(self, e): | |
375 debug("Status change request") | |
376 self.__updateStatus() | |
377 | |
378 def onParam(self, e): | |
379 debug("Param request") | |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
380 param=Param(self) |
0 | 381 |
382 def onExit(self, e): | |
383 self.Close() | |
384 | |
385 def onAddContact(self, e): | |
386 debug("Add contact request") | |
387 dlg = wx.TextEntryDialog( | |
388 self, 'Please enter new contact JID', | |
389 'Adding a contact', 'name@server.ext') | |
390 | |
391 if dlg.ShowModal() == wx.ID_OK: | |
392 jid=JID(dlg.GetValue()) | |
393 if jid.is_valid(): | |
394 self.bridge.addContact(jid.short) | |
395 else: | |
396 error ("'%s' is an invalid JID !", jid) | |
397 #TODO: notice the user | |
398 | |
399 dlg.Destroy() | |
400 | |
401 def onRemoveContact(self, e): | |
402 debug("Remove contact request") | |
403 target = self.contactList.getSelection() | |
404 if not target: | |
405 dlg = wx.MessageDialog(self, "You haven't selected any contact !", | |
406 'Error', | |
407 wx.OK | wx.ICON_ERROR | |
408 ) | |
409 dlg.ShowModal() | |
410 dlg.Destroy() | |
411 return | |
412 | |
413 dlg = wx.MessageDialog(self, "Are you sure you want to delete %s from your roster list ?" % target.short, | |
414 'Contact suppression', | |
415 wx.YES_NO | wx.ICON_QUESTION | |
416 ) | |
417 | |
418 if dlg.ShowModal() == wx.ID_YES: | |
419 info("Unsubsribing %s presence", target.short) | |
420 self.bridge.delContact(target.short) | |
421 | |
422 dlg.Destroy() | |
423 | |
424 def onClose(self, e): | |
425 info("Exiting...") | |
426 e.Skip() | |
11 | 427 |
428 def onTrayClick(self, e): | |
429 debug("Tray Click") | |
430 if self.IsShown(): | |
431 self.Hide() | |
432 else: | |
433 self.Show() | |
434 self.Raise() | |
435 e.Skip() | |
0 | 436 |