Mercurial > libervia-web
comparison browser_side/base_widget.py @ 370:30d03d9f07e4
browser_side: refactorization of the file tools.py:
- tools.py renamed to html_tools.py
- method setPresenceStyle moved to contact.py
- classes DragLabel and LiberviaDragWidget moved to base_widget.py
- class FilterFileUpload moved to file_tools.py
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 23 Feb 2014 17:01:03 +0100 |
parents | ce5b33f499c5 |
children | a71fcc27f231 |
comparison
equal
deleted
inserted
replaced
369:678d1739bbf2 | 370:30d03d9f07e4 |
---|---|
28 from pyjamas.ui.HTMLPanel import HTMLPanel | 28 from pyjamas.ui.HTMLPanel import HTMLPanel |
29 from pyjamas.ui.Label import Label | 29 from pyjamas.ui.Label import Label |
30 from pyjamas.ui.Button import Button | 30 from pyjamas.ui.Button import Button |
31 from pyjamas.ui.Image import Image | 31 from pyjamas.ui.Image import Image |
32 from pyjamas.ui.Widget import Widget | 32 from pyjamas.ui.Widget import Widget |
33 from pyjamas.ui.DragWidget import DragWidget | |
33 from pyjamas.ui.DropWidget import DropWidget | 34 from pyjamas.ui.DropWidget import DropWidget |
34 from pyjamas.ui.ClickListener import ClickHandler | 35 from pyjamas.ui.ClickListener import ClickHandler |
35 from pyjamas.ui import HasAlignment | 36 from pyjamas.ui import HasAlignment |
36 from pyjamas import DOM | 37 from pyjamas import DOM |
37 from pyjamas import Window | 38 from pyjamas import Window |
38 from __pyjamas__ import doc | 39 from __pyjamas__ import doc |
39 | 40 |
40 import dialog | 41 import dialog |
41 from tools import LiberviaDragWidget | 42 |
43 | |
44 class DragLabel(DragWidget): | |
45 | |
46 def __init__(self, text, _type): | |
47 DragWidget.__init__(self) | |
48 self._text = text | |
49 self._type = _type | |
50 | |
51 def onDragStart(self, event): | |
52 dt = event.dataTransfer | |
53 dt.setData('text/plain', "%s\n%s" % (self._text, self._type)) | |
54 dt.setDragImage(self.getElement(), 15, 15) | |
55 | |
56 | |
57 class LiberviaDragWidget(DragLabel): | |
58 """ A DragLabel which keep the widget being dragged as class value """ | |
59 current = None # widget currently dragged | |
60 | |
61 def __init__(self, text, _type, widget): | |
62 DragLabel.__init__(self, text, _type) | |
63 self.widget = widget | |
64 | |
65 def onDragStart(self, event): | |
66 LiberviaDragWidget.current = self.widget | |
67 DragLabel.onDragStart(self, event) | |
68 | |
69 def onDragEnd(self, event): | |
70 LiberviaDragWidget.current = None | |
42 | 71 |
43 | 72 |
44 class DropCell(DropWidget): | 73 class DropCell(DropWidget): |
45 """Cell in the middle grid which replace itself with the dropped widget on DnD""" | 74 """Cell in the middle grid which replace itself with the dropped widget on DnD""" |
46 drop_keys = {} | 75 drop_keys = {} |