Show More
@@ -172,9 +172,9 b' define(["notebook/js/widgets/widget"], function(widget_manager){' | |||||
172 | events: { |
|
172 | events: { | |
173 | // Dictionary of events and their handlers. |
|
173 | // Dictionary of events and their handlers. | |
174 |
|
174 | |||
175 | "keyup input" : "handleChanging", |
|
175 | "keyup input" : "handleChanging", | |
176 | "paste input" : "handleChanging", |
|
176 | "paste input" : "handleChanging", | |
177 | "cut input" : "handleChanging", |
|
177 | "cut input" : "handleChanging", | |
178 |
|
178 | |||
179 | // Fires only when control is validated or looses focus. |
|
179 | // Fires only when control is validated or looses focus. | |
180 | "change input" : "handleChanged" |
|
180 | "change input" : "handleChanged" |
@@ -170,9 +170,9 b' define(["notebook/js/widgets/widget"], function(widget_manager){' | |||||
170 |
|
170 | |||
171 | events: { |
|
171 | events: { | |
172 | // Dictionary of events and their handlers. |
|
172 | // Dictionary of events and their handlers. | |
173 | "keyup input" : "handleChanging", |
|
173 | "keyup input" : "handleChanging", | |
174 | "paste input" : "handleChanging", |
|
174 | "paste input" : "handleChanging", | |
175 | "cut input" : "handleChanging", |
|
175 | "cut input" : "handleChanging", | |
176 |
|
176 | |||
177 | // Fires only when control is validated or looses focus. |
|
177 | // Fires only when control is validated or looses focus. | |
178 | "change input" : "handleChanged" |
|
178 | "change input" : "handleChanged" |
@@ -110,9 +110,9 b' define(["notebook/js/widgets/widget"], function(widget_manager){' | |||||
110 |
|
110 | |||
111 | events: { |
|
111 | events: { | |
112 | // Dictionary of events and their handlers. |
|
112 | // Dictionary of events and their handlers. | |
113 | "keyup textarea": "handleChanging", |
|
113 | "keyup textarea" : "handleChanging", | |
114 | "paste textarea": "handleChanging", |
|
114 | "paste textarea" : "handleChanging", | |
115 | "cut textarea": "handleChanging" |
|
115 | "cut textarea" : "handleChanging" | |
116 | }, |
|
116 | }, | |
117 |
|
117 | |||
118 | handleChanging: function(e) { |
|
118 | handleChanging: function(e) { | |
@@ -171,10 +171,10 b' define(["notebook/js/widgets/widget"], function(widget_manager){' | |||||
171 |
|
171 | |||
172 | events: { |
|
172 | events: { | |
173 | // Dictionary of events and their handlers. |
|
173 | // Dictionary of events and their handlers. | |
174 | "keyup input": "handleChanging", |
|
174 | "keyup input" : "handleChanging", | |
175 | "paste input": "handleChanging", |
|
175 | "paste input" : "handleChanging", | |
176 | "cut input": "handleChanging", |
|
176 | "cut input" : "handleChanging", | |
177 | "keypress input": "handleKeypress" |
|
177 | "keypress input" : "handleKeypress" | |
178 | }, |
|
178 | }, | |
179 |
|
179 | |||
180 | handleChanging: function(e) { |
|
180 | handleChanging: function(e) { |
@@ -1,90 +1,91 b'' | |||||
1 |
|
||||
2 | /* |
|
|||
3 | LESS file that styles IPython notebook widgets and the area they sit in. |
|
|||
4 |
|
||||
5 | The widget area typically looks something like this: |
|
|||
6 | +------------------------------------------+ |
|
|||
7 | | widget-area | |
|
|||
8 | | +--------+---------------------------+ | |
|
|||
9 | | | prompt | widget-subarea | | |
|
|||
10 | | | | +--------+ +--------+ | | |
|
|||
11 | | | | | widget | | widget | | | |
|
|||
12 | | | | +--------+ +--------+ | | |
|
|||
13 | | +--------+---------------------------+ | |
|
|||
14 | +------------------------------------------+ |
|
|||
15 | */ |
|
|||
16 |
|
||||
17 |
|
|
1 | .widget-area { | |
18 | page-break-inside: avoid; |
|
2 | /* | |
|
3 | LESS file that styles IPython notebook widgets and the area they sit in. | |||
|
4 | ||||
|
5 | The widget area typically looks something like this: | |||
|
6 | +------------------------------------------+ | |||
|
7 | | widget-area | | |||
|
8 | | +--------+---------------------------+ | | |||
|
9 | | | prompt | widget-subarea | | | |||
|
10 | | | | +--------+ +--------+ | | | |||
|
11 | | | | | widget | | widget | | | | |||
|
12 | | | | +--------+ +--------+ | | | |||
|
13 | | +--------+---------------------------+ | | |||
|
14 | +------------------------------------------+ | |||
|
15 | */ | |||
|
16 | ||||
|
17 | page-break-inside : avoid; | |||
19 | .hbox(); |
|
18 | .hbox(); | |
20 |
|
19 | |||
21 | .widget-subarea { |
|
20 | .widget-subarea { | |
22 | padding: 0.44em 0.4em 0.4em 1px; |
|
21 | padding : 0.44em 0.4em 0.4em 1px; | |
23 | margin-left: 6px; |
|
22 | margin-left : 6px; | |
|
23 | ||||
24 | .border-box-sizing(); |
|
24 | .border-box-sizing(); | |
25 | .vbox(); |
|
25 | .vbox(); | |
26 | .box-flex2(); |
|
26 | .box-flex2(); | |
27 | } |
|
27 | } | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 |
/* THE CLASSES BELOW CAN APPEAR ANYWHERE IN THE DOM |
|
30 | /* THE CLASSES BELOW CAN APPEAR ANYWHERE IN THE DOM (POSSIBLEY OUTSIDE OF | |
|
31 | THE WIDGET AREA). */ | |||
31 |
|
32 | |||
32 | /* Horizontal Label */ |
|
|||
33 | .widget-hlabel { |
|
33 | .widget-hlabel { | |
34 | min-width: 10ex; |
|
34 | /* Horizontal Label */ | |
35 | padding-right: 8px; |
|
35 | min-width : 10ex; | |
36 |
padding- |
|
36 | padding-right : 8px; | |
37 | text-align: right; |
|
37 | padding-top : 3px; | |
38 | vertical-align: text-top; |
|
38 | text-align : right; | |
|
39 | vertical-align : text-top; | |||
39 | } |
|
40 | } | |
40 |
|
41 | |||
41 | /* Vertical Label */ |
|
|||
42 | .widget-vlabel { |
|
42 | .widget-vlabel { | |
43 | padding-bottom: 5px; |
|
43 | /* Vertical Label */ | |
44 | text-align: center; |
|
44 | padding-bottom : 5px; | |
45 | vertical-align: text-bottom; |
|
45 | text-align : center; | |
|
46 | vertical-align : text-bottom; | |||
46 | } |
|
47 | } | |
47 |
|
48 | |||
48 |
|
||||
49 | /* Slider Track */ |
|
|||
50 | .slide-track { |
|
49 | .slide-track { | |
51 | border: 1px solid #CCCCCC; |
|
50 | /* Slider Track */ | |
52 | background: #FFFFFF; |
|
51 | border : 1px solid #CCCCCC; | |
|
52 | background : #FFFFFF; | |||
|
53 | ||||
53 | .corner-all(); /* Round the corners of the slide track */ |
|
54 | .corner-all(); /* Round the corners of the slide track */ | |
54 | } |
|
55 | } | |
55 |
|
56 | |||
56 | /* Horizontal jQuery Slider |
|
|||
57 |
|
||||
58 | Both the horizontal and vertical versions of the slider are characterized |
|
|||
59 | by a styled div that contains an invisible jQuery slide div which |
|
|||
60 | contains a visible slider handle div. This is requred so we can control |
|
|||
61 | how the slider is drawn and 'fix' the issue where the slide handle |
|
|||
62 | doesn't stop at the end of the slide. |
|
|||
63 |
|
||||
64 | Both horizontal and vertical sliders have this div nesting: |
|
|||
65 | +------------------------------------------+ |
|
|||
66 | | widget-(h/v)slider | |
|
|||
67 | | +--------+---------------------------+ | |
|
|||
68 | | | ui-slider | | |
|
|||
69 | | | +------------------+ | | |
|
|||
70 | | | | ui-slider-handle | | | |
|
|||
71 | | | +------------------+ | | |
|
|||
72 | | +--------+---------------------------+ | |
|
|||
73 | +------------------------------------------+ |
|
|||
74 | */ |
|
|||
75 | .widget-hslider { |
|
57 | .widget-hslider { | |
|
58 | /* Horizontal jQuery Slider | |||
|
59 | ||||
|
60 | Both the horizontal and vertical versions of the slider are characterized | |||
|
61 | by a styled div that contains an invisible jQuery slide div which | |||
|
62 | contains a visible slider handle div. This is requred so we can control | |||
|
63 | how the slider is drawn and 'fix' the issue where the slide handle | |||
|
64 | doesn't stop at the end of the slide. | |||
|
65 | ||||
|
66 | Both horizontal and vertical sliders have this div nesting: | |||
|
67 | +------------------------------------------+ | |||
|
68 | | widget-(h/v)slider | | |||
|
69 | | +--------+---------------------------+ | | |||
|
70 | | | ui-slider | | | |||
|
71 | | | +------------------+ | | | |||
|
72 | | | | ui-slider-handle | | | | |||
|
73 | | | +------------------+ | | | |||
|
74 | | +--------+---------------------------+ | | |||
|
75 | +------------------------------------------+ | |||
|
76 | */ | |||
76 |
|
77 | |||
77 | /* Fix the padding of the slide track so the ui-slider is sized |
|
78 | /* Fix the padding of the slide track so the ui-slider is sized | |
78 | correctly. */ |
|
79 | correctly. */ | |
79 | padding-left: 8px; |
|
80 | padding-left : 8px; | |
80 | padding-right: 5px; |
|
81 | padding-right : 5px; | |
81 | overflow: visible; |
|
82 | overflow : visible; | |
82 |
|
83 | |||
83 | /* Default size of the slider */ |
|
84 | /* Default size of the slider */ | |
84 | width: 348px; |
|
85 | width : 348px; | |
85 | height: 5px; |
|
86 | height : 5px; | |
86 | max-height: 5px; |
|
87 | max-height : 5px; | |
87 | margin-top: 11px; |
|
88 | margin-top : 11px; | |
88 |
|
89 | |||
89 | /* Style the slider track */ |
|
90 | /* Style the slider track */ | |
90 | .slide-track(); |
|
91 | .slide-track(); | |
@@ -92,36 +93,35 b' Both horizontal and vertical sliders have this div nesting:' | |||||
92 | /* Make the div a flex box (makes FF behave correctly). */ |
|
93 | /* Make the div a flex box (makes FF behave correctly). */ | |
93 | .hbox(); |
|
94 | .hbox(); | |
94 |
|
95 | |||
95 | /* Inner, invisible slide div */ |
|
|||
96 | .ui-slider { |
|
96 | .ui-slider { | |
97 | border: 0px !important; |
|
97 | /* Inner, invisible slide div */ | |
98 |
b |
|
98 | border : 0px !important; | |
|
99 | background : none !important; | |||
99 |
|
100 | |||
100 | .hbox(); |
|
101 | .hbox(); | |
101 | .box-flex1(); |
|
102 | .box-flex1(); | |
102 |
|
103 | |||
103 | .ui-slider-handle { |
|
104 | .ui-slider-handle { | |
104 | width: 14px !important; |
|
105 | width : 14px !important; | |
105 | height: 28px !important; |
|
106 | height : 28px !important; | |
106 |
|
107 | margin-top : -8px !important; | ||
107 | margin-top: -8px !important; |
|
|||
108 | } |
|
108 | } | |
109 | } |
|
109 | } | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | /* Vertical jQuery Slider */ |
|
|||
113 | .widget-vslider { |
|
112 | .widget-vslider { | |
|
113 | /* Vertical jQuery Slider */ | |||
114 |
|
114 | |||
115 | /* Fix the padding of the slide track so the ui-slider is sized |
|
115 | /* Fix the padding of the slide track so the ui-slider is sized | |
116 | correctly. */ |
|
116 | correctly. */ | |
117 | padding-bottom: 8px; |
|
117 | padding-bottom : 8px; | |
118 | overflow: visible; |
|
118 | overflow : visible; | |
119 |
|
119 | |||
120 | /* Default size of the slider */ |
|
120 | /* Default size of the slider */ | |
121 | width: 5px; |
|
121 | width : 5px; | |
122 | max-width: 5px; |
|
122 | max-width : 5px; | |
123 | height: 250px; |
|
123 | height : 250px; | |
124 | margin-left: 12px; |
|
124 | margin-left : 12px; | |
125 |
|
125 | |||
126 | /* Style the slider track */ |
|
126 | /* Style the slider track */ | |
127 | .slide-track(); |
|
127 | .slide-track(); | |
@@ -129,113 +129,123 b' Both horizontal and vertical sliders have this div nesting:' | |||||
129 | /* Make the div a flex box (makes FF behave correctly). */ |
|
129 | /* Make the div a flex box (makes FF behave correctly). */ | |
130 | .vbox(); |
|
130 | .vbox(); | |
131 |
|
131 | |||
132 | /* Inner, invisible slide div */ |
|
|||
133 | .ui-slider { |
|
132 | .ui-slider { | |
134 | border: 0px !important; |
|
133 | /* Inner, invisible slide div */ | |
135 |
b |
|
134 | border : 0px !important; | |
136 | margin-left: -4px; |
|
135 | background : none !important; | |
137 |
margin- |
|
136 | margin-left : -4px; | |
|
137 | margin-top : 5px; | |||
138 |
|
138 | |||
139 | .vbox(); |
|
139 | .vbox(); | |
140 | .box-flex1(); |
|
140 | .box-flex1(); | |
141 |
|
141 | |||
142 | .ui-slider-handle { |
|
142 | .ui-slider-handle { | |
143 | width: 28px !important; |
|
143 | width : 28px !important; | |
144 | height: 14px !important; |
|
144 | height : 14px !important; | |
145 | margin-left: -9px; |
|
145 | margin-left : -9px; | |
146 | } |
|
146 | } | |
147 | } |
|
147 | } | |
148 | } |
|
148 | } | |
149 |
|
149 | |||
150 | /* String Textbox - used for TextBoxView and TextAreaView */ |
|
|||
151 | .widget-text { |
|
150 | .widget-text { | |
152 | width: 350px; |
|
151 | /* String Textbox - used for TextBoxView and TextAreaView */ | |
153 | margin-bottom: 0px; |
|
152 | width : 350px; | |
|
153 | margin-bottom : 0px; | |||
154 | } |
|
154 | } | |
155 |
|
155 | |||
156 | /* Listbox */ |
|
|||
157 | .widget-listbox { |
|
156 | .widget-listbox { | |
158 | width: 364px; |
|
157 | /* Listbox */ | |
159 | margin-bottom: 0px; |
|
158 | width : 364px; | |
|
159 | margin-bottom : 0px; | |||
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | /* Single Line Textbox - used for IntTextView and FloatTextView */ |
|
|||
163 | .widget-numeric-text { |
|
162 | .widget-numeric-text { | |
164 | width: 150px; |
|
163 | /* Single Line Textbox - used for IntTextView and FloatTextView */ | |
|
164 | width : 150px; | |||
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | /* Progress Bar */ |
|
|||
168 | .widget-progress { |
|
167 | .widget-progress { | |
169 | width: 363px; |
|
168 | /* Progress Bar */ | |
|
169 | width : 363px; | |||
170 |
|
170 | |||
171 | /* Disable progress bar animation */ |
|
|||
172 | .bar { |
|
171 | .bar { | |
173 | -webkit-transition: none; |
|
172 | /* Disable progress bar animation */ | |
174 |
- |
|
173 | -webkit-transition : none; | |
175 |
-m |
|
174 | -moz-transition : none; | |
176 |
- |
|
175 | -ms-transition : none; | |
177 | transition: none; |
|
176 | -o-transition : none; | |
|
177 | transition : none; | |||
178 | } |
|
178 | } | |
179 | } |
|
179 | } | |
180 |
|
180 | |||
181 | /* ComboBox Main Button */ |
|
|||
182 | .widget-combo-btn { |
|
181 | .widget-combo-btn { | |
183 | min-width: 138px; /* + 26px drop arrow btn = 164px */ |
|
182 | /* ComboBox Main Button */ | |
|
183 | min-width : 138px; /* + 26px drop arrow btn = 164px */ | |||
184 | } |
|
184 | } | |
185 |
|
185 | |||
186 | /* The following section sets the style for the invisible div that |
|
|||
187 | hold widgets and their accompanying labels. |
|
|||
188 |
|
||||
189 | Looks like this: |
|
|||
190 | +-----------------------------+ |
|
|||
191 | | widget-box (or similar) | |
|
|||
192 | | +-------+---------------+ | |
|
|||
193 | | | Label | Actual Widget | | |
|
|||
194 | | +-------+---------------+ | |
|
|||
195 | +-----------------------------+ |
|
|||
196 | */ |
|
|||
197 | .widget-box { |
|
186 | .widget-box { | |
|
187 | /* The following section sets the style for the invisible div that | |||
|
188 | hold widgets and their accompanying labels. | |||
|
189 | ||||
|
190 | Looks like this: | |||
|
191 | +-----------------------------+ | |||
|
192 | | widget-box (or similar) | | |||
|
193 | | +-------+---------------+ | | |||
|
194 | | | Label | Actual Widget | | | |||
|
195 | | +-------+---------------+ | | |||
|
196 | +-----------------------------+ | |||
|
197 | */ | |||
|
198 | margin : 5px; | |||
|
199 | ||||
198 | .start(); |
|
200 | .start(); | |
199 | .widget-container(); |
|
201 | .widget-container(); | |
200 | margin: 5px; |
|
|||
201 | } |
|
202 | } | |
202 | .widget-hbox { /* Horizontal widgets */ |
|
203 | ||
|
204 | .widget-hbox { | |||
|
205 | /* Horizontal widgets */ | |||
203 | .widget-box(); |
|
206 | .widget-box(); | |
204 | .hbox(); |
|
207 | .hbox(); | |
205 | } |
|
208 | } | |
206 | .widget-hbox-single { /* Single line horizontal widgets */ |
|
209 | ||
|
210 | .widget-hbox-single { | |||
|
211 | /* Single line horizontal widgets */ | |||
|
212 | height : 30px; | |||
|
213 | ||||
207 | .widget-hbox(); |
|
214 | .widget-hbox(); | |
208 | height: 30px; |
|
|||
209 | } |
|
215 | } | |
210 | .widget-vbox-single { /* For vertical slides */ |
|
216 | ||
|
217 | .widget-vbox-single { | |||
|
218 | /* For vertical slides */ | |||
|
219 | width : 30px; | |||
|
220 | ||||
211 | .widget-box(); |
|
221 | .widget-box(); | |
212 | .vbox(); |
|
222 | .vbox(); | |
213 | width: 30px; |
|
|||
214 | } |
|
223 | } | |
215 | /* ContainerWidget - ModalView */ |
|
224 | ||
216 | .widget-modal { |
|
225 | .widget-modal { | |
217 | overflow: hidden; |
|
226 | /* ContainerWidget - ModalView */ | |
218 | position: absolute !important; |
|
227 | overflow : hidden; | |
219 | top: 0px; |
|
228 | position : absolute !important; | |
220 |
|
|
229 | top : 0px; | |
221 | margin-left: 0px !important; |
|
230 | left : 0px; | |
|
231 | margin-left : 0px !important; | |||
222 | } |
|
232 | } | |
223 |
|
233 | |||
224 | /* ContainerWidget - ModalView Body */ |
|
|||
225 | .widget-modal-body { |
|
234 | .widget-modal-body { | |
|
235 | /* ContainerWidget - ModalView Body */ | |||
226 | max-height: none !important; |
|
236 | max-height: none !important; | |
227 | } |
|
237 | } | |
228 |
|
238 | |||
229 | /* ContainerWidget */ |
|
|||
230 | .widget-container { |
|
239 | .widget-container { | |
|
240 | /* ContainerWidget */ | |||
231 | .border-box-sizing(); |
|
241 | .border-box-sizing(); | |
232 | } |
|
242 | } | |
233 |
|
243 | |||
234 | /* Horizontal Label */ |
|
|||
235 | .docked-widget-modal { |
|
244 | .docked-widget-modal { | |
|
245 | /* Horizontal Label */ | |||
236 | overflow: hidden; |
|
246 | overflow: hidden; | |
237 | position: relative !important; |
|
247 | position: relative !important; | |
238 | top: 0px !important; |
|
248 | top: 0px !important; | |
239 | left: 0px !important; |
|
249 | left: 0px !important; | |
240 | margin-left: 0px !important; |
|
250 | margin-left: 0px !important; | |
241 |
} |
|
251 | } No newline at end of file |
@@ -179,8 +179,10 b' class Widget(LoggingConfigurable):' | |||||
179 | key : unicode (optional) |
|
179 | key : unicode (optional) | |
180 | A single property's name to sync with the front-end. |
|
180 | A single property's name to sync with the front-end. | |
181 | """ |
|
181 | """ | |
182 |
self._send({ |
|
182 | self._send({ | |
183 | "state": self.get_state()}) |
|
183 | "method" : "update", | |
|
184 | "state" : self.get_state() | |||
|
185 | }) | |||
184 |
|
186 | |||
185 | def get_state(self, key=None): |
|
187 | def get_state(self, key=None): | |
186 | """Gets the widget state, or a piece of it. |
|
188 | """Gets the widget state, or a piece of it. | |
@@ -405,9 +407,11 b' class DOMWidget(Widget):' | |||||
405 | if isinstance(class_list, list): |
|
407 | if isinstance(class_list, list): | |
406 | class_list = ' '.join(class_list) |
|
408 | class_list = ' '.join(class_list) | |
407 |
|
409 | |||
408 |
self.send({ |
|
410 | self.send({ | |
409 | "class_list": class_list, |
|
411 | "msg_type" : "add_class", | |
410 |
" |
|
412 | "class_list" : class_list, | |
|
413 | "selector" : selector | |||
|
414 | }) | |||
411 |
|
415 | |||
412 | def remove_class(self, class_names, selector=""): |
|
416 | def remove_class(self, class_names, selector=""): | |
413 | """Remove class[es] from a DOM element. |
|
417 | """Remove class[es] from a DOM element. | |
@@ -424,6 +428,8 b' class DOMWidget(Widget):' | |||||
424 | if isinstance(class_list, list): |
|
428 | if isinstance(class_list, list): | |
425 | class_list = ' '.join(class_list) |
|
429 | class_list = ' '.join(class_list) | |
426 |
|
430 | |||
427 | self.send({"msg_type": "remove_class", |
|
431 | self.send({ | |
428 | "class_list": class_list, |
|
432 | "msg_type" : "remove_class", | |
429 |
" |
|
433 | "class_list" : class_list, | |
|
434 | "selector" : selector, | |||
|
435 | }) |
General Comments 0
You need to be logged in to leave comments.
Login now