vigiboard / README / README_jquery / ui_dialog.py @ 7b54a690
History | View | Annotate | Download (3.04 KB)
1 | 49c8da1d | Thomas ANDREJAK | # Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|---|---|---|
2 | # of this software and associated documentation files (the "Software"), to deal
|
||
3 | # in the Software without restriction, including without limitation the rights
|
||
4 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
5 | # copies of the Software, and to permit persons to whom the Software is
|
||
6 | # furnished to do so, subject to the following conditions:
|
||
7 | #
|
||
8 | # The above copyright notice and this permission notice shall be included in
|
||
9 | # all copies or substantial portions of the Software.
|
||
10 | #
|
||
11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
12 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
13 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
14 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
15 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
16 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||
17 | # THE SOFTWARE.
|
||
18 | |||
19 | from tw.api import Widget, JSLink, CSSLink, js_function, js_callback |
||
20 | from tw.jquery import JQuery |
||
21 | from tw.jquery.direction import * |
||
22 | from tw.forms import FormField |
||
23 | from ui_core import jquery_ui_core_js |
||
24 | from ui import ui_dialog_js , ui_draggable_js, ui_resizable_js |
||
25 | |||
26 | 20367931 | Thomas ANDREJAK | __all__ = ["jquery_ui_dialog_js"]
|
27 | 49c8da1d | Thomas ANDREJAK | |
28 | jquery_ui_dialog_css = CSSLink(modname=__name__, filename='static/css/ui.all.css')
|
||
29 | |||
30 | jQuery = js_function('jQuery')
|
||
31 | |||
32 | class JQueryUIDialog(Widget): |
||
33 | |||
34 | javascript = [ui_dialog_js,ui_draggable_js,jquery_ui_core_js,jquery_direction_js,ui_resizable_js] |
||
35 | css=[jquery_ui_dialog_css] |
||
36 | |||
37 | params = ["autoOpen","bgiframe","buttons","closeOnEscape","dialogClass" |
||
38 | "draggable","height","hide","maxHeight","maxWidht","minHeight","minWidth" |
||
39 | "modal","position","resizable","show","stack","title","width","zindex" ] |
||
40 | |||
41 | autoOpen = True
|
||
42 | bgiframe = False
|
||
43 | buttons = {} |
||
44 | closeOnEscape = True
|
||
45 | dialogClass = ""
|
||
46 | draggable = True
|
||
47 | height = "auto"
|
||
48 | hide = None
|
||
49 | maxHeight = False
|
||
50 | maxWidth = False
|
||
51 | minHeight = 15
|
||
52 | minWidth = 15
|
||
53 | modal = False
|
||
54 | position = "center"
|
||
55 | resizable = False
|
||
56 | show = None
|
||
57 | stack = True
|
||
58 | title = ''
|
||
59 | width = "auto"
|
||
60 | zindex = 1000
|
||
61 | def update_params(self, d): |
||
62 | super(JQueryUIDialog, self).update_params(d) |
||
63 | if not getattr(d,"id",None): |
||
64 | raise ValueError, "JQueryUIDialog is supposed to have id" |
||
65 | dialog_params = dict ( autoOpen = self.autoOpen, |
||
66 | bgiframe = self.bgiframe,
|
||
67 | buttons = self.buttons,
|
||
68 | closeOnEscape = self.closeOnEscape,
|
||
69 | dialogClass = self.dialogClass,
|
||
70 | draggable = self.draggable,
|
||
71 | height = self.height,
|
||
72 | hide = self.hide,
|
||
73 | maxHeight = self.maxHeight,
|
||
74 | maxWidth = self.maxWidth,
|
||
75 | minHeight = self.minHeight,
|
||
76 | minWidth = self.minWidth,
|
||
77 | modal = self.modal,
|
||
78 | position = self.position,
|
||
79 | resizable = self.resizable,
|
||
80 | show = self.show,
|
||
81 | stack = self.stack,
|
||
82 | title = self.title,
|
||
83 | width = self.width,
|
||
84 | 20367931 | Thomas ANDREJAK | zindex = self.zindex
|
85 | 49c8da1d | Thomas ANDREJAK | |
86 | ) |
||
87 | self.add_call(jQuery("#%s" % d.id).dialog(dialog_params)) |