Mercurial > libervia-web
diff src/browser/sat_browser/contact.py @ 485:5911f71acc80
browser side: move contacts list's avatar from right to top
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 18 Jun 2014 13:06:09 +0200 |
parents | 50b286866739 |
children | 587fe75d1b16 |
line wrap: on
line diff
--- a/src/browser/sat_browser/contact.py Tue Jun 17 17:13:56 2014 +0200 +++ b/src/browser/sat_browser/contact.py Wed Jun 18 13:06:09 2014 +0200 @@ -73,19 +73,13 @@ self.host.getOrCreateLiberviaWidget(panels.MicroblogPanel, self.group) -class ContactLabel(base_widget.DragLabel, HTML, ClickHandler): - def __init__(self, host, jid, name=None, handleClick=True): +class ContactLabel(HTML): + def __init__(self, jid, name=None): HTML.__init__(self) - self.host = host self.name = name or jid self.waiting = False - self.jid = jid self.refresh() self.setStyleName('contactLabel') - base_widget.DragLabel.__init__(self, jid, "CONTACT") - if handleClick: - ClickHandler.__init__(self) - self.addClickListener(self) def refresh(self): if self.waiting: @@ -100,23 +94,21 @@ self.waiting = waiting self.refresh() - def onClick(self, sender): - self.host.getOrCreateLiberviaWidget(panels.ChatPanel, self.jid) - -class ContactBox(HorizontalPanel): +class ContactBox(base_widget.DragLabel, VerticalPanel, ClickHandler): def __init__(self, host, jid, name=None, handleClick=True): - HorizontalPanel.__init__(self, StyleName='contactBox', VerticalAlignment='middle') + VerticalPanel.__init__(self, StyleName='contactBox', VerticalAlignment='middle') + base_widget.DragLabel.__init__(self, jid, "CONTACT") + self.host = host self.jid = jid - self.label = ContactLabel(host, jid, name, handleClick) + self.label = ContactLabel(jid, name) self.avatar = Image() self.updateAvatar(host.getAvatar(jid)) + self.add(self.avatar) self.add(self.label) - spacer = Label(' ') - self.add(spacer) - self.setCellWidth(spacer, '100%') - self.add(self.avatar) - self.setCellHorizontalAlignment(self.avatar, 'right') + if handleClick: + ClickHandler.__init__(self) + self.addClickListener(self) def setMessageWaiting(self, waiting): """Show a visual indicator if message are waiting @@ -132,6 +124,9 @@ self.avatar.setVisible(url != C.DEFAULT_AVATAR) self.avatar.setUrl(url) + def onClick(self, sender): + self.host.getOrCreateLiberviaWidget(panels.ChatPanel, self.jid) + class GroupList(VerticalPanel):