comparison frontends/src/wix/contact_list.py @ 812:084b52afdceb

frontends: fixed /me usage + renamed a couple of "type" parameters to type_
author Goffi <goffi@goffi.org>
date Tue, 04 Feb 2014 18:51:16 +0100
parents 1fe00f0c9a91
children 6f1e03068b5f
comparison
equal deleted inserted replaced
811:1fe00f0c9a91 812:084b52afdceb
34 """Class used to recognize groups""" 34 """Class used to recognize groups"""
35 35
36 class ContactList(wx.SimpleHtmlListBox, QuickContactList): 36 class ContactList(wx.SimpleHtmlListBox, QuickContactList):
37 """Customized control to manage contacts.""" 37 """Customized control to manage contacts."""
38 38
39 def __init__(self, parent, host, type="JID"): 39 def __init__(self, parent, host, type_="JID"):
40 """init the contact list 40 """init the contact list
41 @param parent: WxWidgets parent of the widget 41 @param parent: WxWidgets parent of the widget
42 @param host: wix main app class 42 @param host: wix main app class
43 @param type: type of contact list: "JID" for the usual big jid contact list 43 @param type_: type of contact list: "JID" for the usual big jid contact list
44 "CUSTOM" for a customized contact list (self.__presentItem must then be overrided) 44 "CUSTOM" for a customized contact list (self.__presentItem must then be overrided)
45 """ 45 """
46 wx.SimpleHtmlListBox.__init__(self, parent, -1) 46 wx.SimpleHtmlListBox.__init__(self, parent, -1)
47 QuickContactList.__init__(self) 47 QuickContactList.__init__(self)
48 self.host = host 48 self.host = host
49 self.type = type 49 self.type = type_
50 self.__typeSwitch() 50 self.__typeSwitch()
51 self.groups = {} #list contacts in each groups, key = group 51 self.groups = {} #list contacts in each groups, key = group
52 self.empty_avatar = join(host.media_dir, 'misc/empty_avatar') 52 self.empty_avatar = join(host.media_dir, 'misc/empty_avatar')
53 self.Bind(wx.EVT_LISTBOX, self.onSelected) 53 self.Bind(wx.EVT_LISTBOX, self.onSelected)
54 self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated) 54 self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated)
57 return bool(self.__find_idx(jid)) 57 return bool(self.__find_idx(jid))
58 58
59 def __typeSwitch(self): 59 def __typeSwitch(self):
60 if self.type == "JID": 60 if self.type == "JID":
61 self.__presentItem = self.__presentItemJID 61 self.__presentItem = self.__presentItemJID
62 elif type != "CUSTOM": 62 elif type_ != "CUSTOM":
63 self.__presentItem = self.__presentItemDefault 63 self.__presentItem = self.__presentItemDefault
64 64
65 def __find_idx(self, entity): 65 def __find_idx(self, entity):
66 """Find indexes of given contact (or groups) in contact list, manage jid 66 """Find indexes of given contact (or groups) in contact list, manage jid
67 @return: list of indexes""" 67 @return: list of indexes"""