# HG changeset patch # User Goffi # Date 1301009487 -3600 # Node ID c80b75bf2e91fc463547c564e4a2554eb15ed357 # Parent 88ae360198ee0e09a65bc973e29b4e0cedc24442 browser: misc appearance change diff -r 88ae360198ee -r c80b75bf2e91 libervia.py --- 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(" ") - #_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=' ' 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=' '): + title=title.replace('<','<').replace('>','>') VerticalPanel.__init__(self) + _class = ['mb_panel_header'] + if title == ' ': + _class.append('empty_header') + self.add(HTMLPanel("
%s
" % (','.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__': diff -r 88ae360198ee -r c80b75bf2e91 public/libervia.css --- 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 {