changeset 9:c80b75bf2e91

browser: misc appearance change
author Goffi <goffi@goffi.org>
date Fri, 25 Mar 2011 00:31:27 +0100
parents 88ae360198ee
children c28a4840e1a8
files libervia.py public/libervia.css
diffstat 2 files changed, 27 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libervia.py	Fri Mar 25 00:28:41 2011 +0100
+++ b/libervia.py	Fri Mar 25 00:31:27 2011 +0100
@@ -162,30 +162,27 @@
 class EmptyPanel(DropWidget, SimplePanel):
     """Empty dropable panel"""
 
-    def __init__(self):
+    def __init__(self, host, data):
         SimplePanel.__init__(self)
+        self.host = host
+        self.data = data
         _panel = HTMLPanel("&nbsp;")
-        #_panel.setHeight('100%')
-        #_panel.setWidth('100%')
         self.add(_panel)
         self.setHeight('100%')
         DropWidget.__init__(self)
     
     def onDragEnter(self, event):
-        print "Empty Panel: onDragEnter"
         self.addStyleName('dragover')
         DOM.eventPreventDefault(event)
 
     def onDragLeave(self, event):
-        print "Empty Panel: onDragLeave"
         self.removeStyleName('dragover')
 
     def onDragOver(self, event):
-        print "Empty Panel: onDragOver"
         DOM.eventPreventDefault(event)
 
     def onDrop(self, event):
-        print "Empty Panel: onDragOver"
+        print "Empty Panel: onDrop"
         dt = event.dataTransfer
         #'text', 'text/plain', and 'Text' are equivalent.
         try:
@@ -193,7 +190,10 @@
             print "message: %s" % item
         except:
             print "no message found"
+            item='&nbsp;'
         DOM.eventPreventDefault(event)
+        self.host.mpanels.insert(0,MicroblogPanel(item))
+        self.host.middle_panel.changePanel(self.data,self.host.mpanels[0])
 
 
 
@@ -215,8 +215,13 @@
 
 class MicroblogPanel(VerticalPanel):
 
-    def __init__(self):
+    def __init__(self,title='&nbsp;'):
+        title=title.replace('<','&lt;').replace('>','&gt;')
         VerticalPanel.__init__(self)
+        _class = ['mb_panel_header']
+        if title == '&nbsp;':
+            _class.append('empty_header')
+        self.add(HTMLPanel("<div class='%s'>%s</div>" % (','.join(_class),title)))
         self.setStyleName('microblogPanel')
 
     def addEntry(self, text, author=None, timestamp=None):
@@ -283,8 +288,8 @@
         self.middle_panel = self.panel.middle_panel
         self.mpanels = [MicroblogPanel()]
         self.middle_panel.changePanel(1,self.mpanels[0])
-        self.middle_panel.changePanel(0,EmptyPanel())
-        self.middle_panel.changePanel(2,EmptyPanel())
+        self.middle_panel.changePanel(0,EmptyPanel(self, 0))
+        self.middle_panel.changePanel(2,EmptyPanel(self, 2))
         self._dialog = None
         RootPanel().add(self.panel)
         self._register = RegisterCall()
@@ -341,7 +346,7 @@
                     content = data['content']
                     author = data.get('author')
                     print "timestamp: %s" % data.get('timestamp')
-                    timestamp = float(data.get('timestamp'),0) #XXX: int doesn't work here
+                    timestamp = float(data.get('timestamp',0)) #XXX: int doesn't work here
                     panel.addEntry(content, author, timestamp)
 
 if __name__ == '__main__':
--- a/public/libervia.css	Fri Mar 25 00:28:41 2011 +0100
+++ b/public/libervia.css	Fri Mar 25 00:31:27 2011 +0100
@@ -165,6 +165,17 @@
 
 .microblogPanel {
     margin: auto;
+    width: 90%;
+}
+
+.mb_panel_header{
+    text-align: center;
+    background-color: lightGray;
+    font-style: italic;
+    margin-top: 5px;
+    -moz-border-radius: 50px;
+    -webkit-border-radius: 50px;
+    border-radius: 50px;
 }
 
 .microblogEntry {