comparison src/browser/sat_browser/contact_list.py @ 671:2201ff543a05 frontends_multi_profiles

browser_side: replace ContactsPanel and ContactBox init "parent" attribute with "host" + menus bound to the avatar can be parameterized
author souliane <souliane@mailoo.org>
date Mon, 09 Mar 2015 16:30:06 +0100
parents 1bf645e73fe8
children e489218886d7
comparison
equal deleted inserted replaced
670:a80c13249f5d 671:2201ff543a05
134 134
135 135
136 class ContactsPanel(contact_panel.ContactsPanel): 136 class ContactsPanel(contact_panel.ContactsPanel):
137 """The contact list that is displayed on the left side.""" 137 """The contact list that is displayed on the left side."""
138 138
139 def __init__(self, parent): 139 def __init__(self, host):
140
140 def on_click(contact_jid): 141 def on_click(contact_jid):
141 self.host.displayWidget(chat.Chat, contact_jid, type_=C.CHAT_ONE2ONE) 142 self.host.displayWidget(chat.Chat, contact_jid, type_=C.CHAT_ONE2ONE)
142 contact_panel.ContactsPanel.__init__(self, parent, on_click=on_click, handle_menu=True) 143
144 contact_panel.ContactsPanel.__init__(self, host, contacts_click=on_click,
145 contacts_menus=(C.MENU_JID_CONTEXT, C.MENU_ROSTER_JID_CONTEXT))
143 146
144 def setState(self, jid_, type_, state): 147 def setState(self, jid_, type_, state):
145 """Change the appearance of the contact, according to the state 148 """Change the appearance of the contact, according to the state
146 149
147 @param jid_ (jid.JID): jid.JID which need to change state 150 @param jid_ (jid.JID): jid.JID which need to change state
183 self.host = host 186 self.host = host
184 self.scroll_panel = ScrollPanel() 187 self.scroll_panel = ScrollPanel()
185 self.vPanel = VerticalPanel() 188 self.vPanel = VerticalPanel()
186 _title = ContactTitleLabel(host, 'Contacts') 189 _title = ContactTitleLabel(host, 'Contacts')
187 DOM.setStyleAttribute(_title.getElement(), "cursor", "pointer") 190 DOM.setStyleAttribute(_title.getElement(), "cursor", "pointer")
188 self._contacts_panel = ContactsPanel(self) 191 self._contacts_panel = ContactsPanel(host)
189 self._contacts_panel.setStyleName('contactPanel') # FIXME: style doesn't exists ! 192 self._contacts_panel.setStyleName('contactPanel') # FIXME: style doesn't exists !
190 self._group_panel = GroupPanel(self) 193 self._group_panel = GroupPanel(self)
191 194
192 self.vPanel.add(_title) 195 self.vPanel.add(_title)
193 self.vPanel.add(self._group_panel) 196 self.vPanel.add(self._group_panel)