comparison frontends/wix/main_window.py @ 89:23caf1051099

multi-profile/subscription misc fixes
author Goffi <goffi@goffi.org>
date Thu, 13 May 2010 16:27:48 +0930
parents fc7583282d40
children 4020931569b8
comparison
equal deleted inserted replaced
88:59f181e8433a 89:23caf1051099
116 116
117 self.Show() 117 self.Show()
118 118
119 def plug_profile(self, profile_key='@DEFAULT@'): 119 def plug_profile(self, profile_key='@DEFAULT@'):
120 """Hide profile panel then plug profile""" 120 """Hide profile panel then plug profile"""
121 debug (_('plugin profile %s' % profile_key))
121 self.profile_pan.Hide() 122 self.profile_pan.Hide()
122 self.contactList.Show() 123 self.contactList.Show()
123 self.sizer.Layout() 124 self.sizer.Layout()
124 for i in range(self.menuBar.GetMenuCount()): 125 for i in range(self.menuBar.GetMenuCount()):
125 self.menuBar.EnableTop(i, True) 126 self.menuBar.EnableTop(i, True)
328 self.bridge.disconnect(self.profile) 329 self.bridge.disconnect(self.profile)
329 330
330 def __updateStatus(self): 331 def __updateStatus(self):
331 show = filter(lambda x:x[1] == self.statusBox.GetValue(), const_STATUS)[0][0] 332 show = filter(lambda x:x[1] == self.statusBox.GetValue(), const_STATUS)[0][0]
332 status = self.statusTxt.GetValue() 333 status = self.statusTxt.GetValue()
333 self.bridge.setPresence(show=show, statuses={'default':status}) #FIXME: manage multilingual statuses 334 self.bridge.setPresence(show=show, statuses={'default':status}, profile_key=self.profile) #FIXME: manage multilingual statuses
334 335
335 def onStatusChange(self, e): 336 def onStatusChange(self, e):
336 debug(_("Status change request")) 337 debug(_("Status change request"))
337 self.__updateStatus() 338 self.__updateStatus()
338 339
350 _('Adding a contact'), _('name@server.tld')) 351 _('Adding a contact'), _('name@server.tld'))
351 352
352 if dlg.ShowModal() == wx.ID_OK: 353 if dlg.ShowModal() == wx.ID_OK:
353 jid=JID(dlg.GetValue()) 354 jid=JID(dlg.GetValue())
354 if jid.is_valid(): 355 if jid.is_valid():
355 self.bridge.addContact(jid.short) 356 self.bridge.addContact(jid.short, profile_key=self.profile)
356 else: 357 else:
357 error (_("'%s' is an invalid JID !"), jid) 358 error (_("'%s' is an invalid JID !"), jid)
358 #TODO: notice the user 359 #TODO: notice the user
359 360
360 dlg.Destroy() 361 dlg.Destroy()
376 wx.YES_NO | wx.ICON_QUESTION 377 wx.YES_NO | wx.ICON_QUESTION
377 ) 378 )
378 379
379 if dlg.ShowModal() == wx.ID_YES: 380 if dlg.ShowModal() == wx.ID_YES:
380 info(_("Unsubscribing %s presence"), target.short) 381 info(_("Unsubscribing %s presence"), target.short)
381 self.bridge.delContact(target.short) 382 self.bridge.delContact(target.short, profile_key=self.profile)
382 383
383 dlg.Destroy() 384 dlg.Destroy()
384 385
385 def onShowProfile(self, e): 386 def onShowProfile(self, e):
386 debug(_("Show contact's profile request")) 387 debug(_("Show contact's profile request"))
391 wx.OK | wx.ICON_ERROR 392 wx.OK | wx.ICON_ERROR
392 ) 393 )
393 dlg.ShowModal() 394 dlg.ShowModal()
394 dlg.Destroy() 395 dlg.Destroy()
395 return 396 return
396 id = self.bridge.getCard(target.short) 397 id = self.bridge.getCard(target.short, profile_key=self.profile)
397 self.current_action_ids.add(id) 398 self.current_action_ids.add(id)
398 self.current_action_ids_cb[id] = self.onProfileReceived 399 self.current_action_ids_cb[id] = self.onProfileReceived
399 400
400 def onProfileReceived(self, data): 401 def onProfileReceived(self, data):
401 """Called when a profile is received""" 402 """Called when a profile is received"""