comparison frontends/src/wix/contact_list.py @ 366:0806a65a5fa9

wix: updated paths to use media_dir
author Goffi <goffi@goffi.org>
date Sat, 18 Jun 2011 22:51:33 +0200
parents 3a21d586dae4
children cf005701624b
comparison
equal deleted inserted replaced
365:efbfccfed623 366:0806a65a5fa9
22 import wx 22 import wx
23 from sat_frontends.quick_frontend.quick_contact_list import QuickContactList 23 from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
24 from logging import debug, info, error 24 from logging import debug, info, error
25 from cgi import escape 25 from cgi import escape
26 from sat.tools.jid import JID 26 from sat.tools.jid import JID
27 from os.path import join
27 28
28 29
29 class Group(unicode): 30 class Group(unicode):
30 """Class used to recognize groups""" 31 """Class used to recognize groups"""
31 32
46 QuickContactList.__init__(self, host.CM) 47 QuickContactList.__init__(self, host.CM)
47 self.host = host 48 self.host = host
48 self.type = type 49 self.type = type
49 self.__typeSwitch() 50 self.__typeSwitch()
50 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')
51 self.Bind(wx.EVT_LISTBOX, self.onSelected) 53 self.Bind(wx.EVT_LISTBOX, self.onSelected)
52 self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated) 54 self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated)
53 55
54 def __contains__(self, jid): 56 def __contains__(self, jid):
55 return bool(self.__find_idx(jid)) 57 return bool(self.__find_idx(jid))
112 #show[0]==shortcut 114 #show[0]==shortcut
113 #show[1]==human readable 115 #show[1]==human readable
114 #show[2]==color (or None) 116 #show[2]==color (or None)
115 show_html = "<font color='%s'>[%s]</font>" % (show[2], show[1]) if show[2] else "" 117 show_html = "<font color='%s'>[%s]</font>" % (show[2], show[1]) if show[2] else ""
116 status = self.CM.getAttr(jid,'status') or '' 118 status = self.CM.getAttr(jid,'status') or ''
117 avatar = self.CM.getAttr(jid,'avatar') or IMAGE_DIR+'/empty_avatar' #XXX: there is a weird bug here: if the image has an extension (i.e. empty_avatar.png), 119 avatar = self.CM.getAttr(jid,'avatar') or self.empty_avatar #XXX: there is a weird bug here: if the image has an extension (i.e. empty_avatar.png),
118 #WxPython segfault, and it doesn't without nothing. I couldn't reproduce the case with a basic test script, so it need further investigation before reporting it 120 #WxPython segfault, and it doesn't without nothing. I couldn't reproduce the case with a basic test script, so it need further investigation before reporting it
119 #to WxPython dev. Anyway, the program crash with a segfault, not a python exception, so there is definitely something wrong with WxPython. 121 #to WxPython dev. Anyway, the program crash with a segfault, not a python exception, so there is definitely something wrong with WxPython.
120 #The case seems to happen when SimpleHtmlListBox parse the HTML with the <img> tag 122 #The case seems to happen when SimpleHtmlListBox parse the HTML with the <img> tag
121 123
122 html = """ 124 html = """