Mercurial > libervia-web
diff libervia.py @ 9:c80b75bf2e91
browser: misc appearance change
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 Mar 2011 00:31:27 +0100 |
parents | a663b9955cf3 |
children | 331c093e4eb3 |
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(" ") - #_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("<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__':