changeset 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 ae86b32b959c
children 600a71743072
files src/browser/public/libervia.css src/browser/sat_browser/contact.py
diffstat 2 files changed, 20 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/public/libervia.css	Tue Jun 17 17:13:56 2014 +0200
+++ b/src/browser/public/libervia.css	Wed Jun 18 13:06:09 2014 +0200
@@ -429,10 +429,16 @@
 .contactBox {
     cursor: pointer;
     width: 100%;
+    margin: 5px;
+    border-radius: 5px;
+    background: #EDEDED;
 }
 
 .contactBox img {
     width: 32px;
+    height: 32px;
+    border-radius: 5px;
+    margin: 5px 0px 0px 10px;
     border-radius: 5px;
 }
 
--- 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):