comparison browser_side/contact.py @ 196:c2639c9f86ea

Browser Side: Widgets can now be moved, header (title bar) is draggable: - DragLabel moved to tools - new LiberviaDragWidget which manage currently dragged widget - getLiberviaWidgetsCount give number of widget of WidgetsPanel - LiberviaWidget's header has now its own class - new "WIDGET" drag type /!\ not fully finished, can crash if moved on the bad border (like last row border if the widget is the only one on this row)
author Goffi <goffi@goffi.org>
date Tue, 05 Mar 2013 01:20:59 +0100
parents dd27072d8ae0
children 0f5c2f799913
comparison
equal deleted inserted replaced
195:dd27072d8ae0 196:c2639c9f86ea
21 21
22 import pyjd # this is dummy in pyjs 22 import pyjd # this is dummy in pyjs
23 from pyjamas.ui.SimplePanel import SimplePanel 23 from pyjamas.ui.SimplePanel import SimplePanel
24 from pyjamas.ui.ScrollPanel import ScrollPanel 24 from pyjamas.ui.ScrollPanel import ScrollPanel
25 from pyjamas.ui.VerticalPanel import VerticalPanel 25 from pyjamas.ui.VerticalPanel import VerticalPanel
26 from pyjamas.ui.HorizontalPanel import HorizontalPanel
27 from pyjamas.ui.Label import Label 26 from pyjamas.ui.Label import Label
28 from pyjamas.ui.HTML import HTML 27 from pyjamas.ui.HTML import HTML
29 from pyjamas import Window 28 from pyjamas import Window
30 from pyjamas import DOM 29 from pyjamas import DOM
31 30
32 from pyjamas.ui.DragWidget import DragWidget, DragContainer 31 from browser_side.tools import DragLabel, html_sanitize
33 from browser_side.tools import html_sanitize
34 from jid import JID
35 from __pyjamas__ import doc 32 from __pyjamas__ import doc
36
37 class DragLabel(DragWidget):
38
39 def __init__(self, text, _type):
40 DragWidget.__init__(self)
41 self._text = text
42 self._type = _type
43
44 def onDragStart(self, event):
45 dt = event.dataTransfer
46 dt.setData('text/plain', "%s\n%s" % (self._text, self._type))
47 dt.setDragImage(self.getElement(), 15, 15)
48 33
49 class GroupLabel(DragLabel, Label): 34 class GroupLabel(DragLabel, Label):
50 def __init__(self, group): 35 def __init__(self, group):
51 self.group = group 36 self.group = group
52 Label.__init__(self, group) #, Element=DOM.createElement('div') 37 Label.__init__(self, group) #, Element=DOM.createElement('div')