diff browser_side/panels.py @ 20:8f4b1a8914c3

- User status is now updated - by default, the uniBar target the status - clicking on user's status unselect the selected widget
author Goffi <goffi@goffi.org>
date Sat, 16 Apr 2011 18:06:02 +0200
parents e8e3704eb97f
children 586f69e85559
line wrap: on
line diff
--- a/browser_side/panels.py	Sat Apr 16 01:46:01 2011 +0200
+++ b/browser_side/panels.py	Sat Apr 16 18:06:02 2011 +0200
@@ -212,18 +212,26 @@
                 return True
         return False
 
-class StatusPanel(HTMLPanel):
-    def __init__(self, status=''):
-        self.status = status
+class StatusPanel(HTMLPanel, ClickHandler):
+    def __init__(self, host, status=''):
+        self.host = host
+        self.status = status or '&nbsp;'
         HTMLPanel.__init__(self, self.__getContent())
+        self.setStyleName('statusPanel')
+        ClickHandler.__init__(self)
+        self.addClickListener(self)
 
     def __getContent(self):
         return "<span class='status'>%(status)s</span>" % {'status':self.status}
 
     def changeStatus(self, new_status):
-        self.status = new_status
+        self.status = new_status or '&nbsp;'
         self.setHTML(self.__getContent())
 
+    def onClick(self, sender, event):
+        #As status is the default target of uniBar, we don't want to select anything if click on it
+        self.host.select(None)
+
 class ChatText(HTMLPanel):
 
     def __init__(self, timestamp, nick, mymess, msg):