Show More
@@ -13,12 +13,14 require(["notebook/js/widget"], function(){ | |||||
13 |
|
13 | |||
14 | var $label = $('<label />') |
|
14 | var $label = $('<label />') | |
15 | .addClass('checkbox') |
|
15 | .addClass('checkbox') | |
|
16 | .addClass('widget-label') | |||
16 | .appendTo(this.$el); |
|
17 | .appendTo(this.$el); | |
|
18 | this.$checkbox_label = $('<div />') | |||
|
19 | .appendTo($label) | |||
|
20 | .hide(); | |||
17 | this.$checkbox = $('<input />') |
|
21 | this.$checkbox = $('<input />') | |
18 | .attr('type', 'checkbox') |
|
22 | .attr('type', 'checkbox') | |
19 | .appendTo($label); |
|
23 | .appendTo($label); | |
20 | this.$checkbox_label = $('<div />') |
|
|||
21 | .appendTo($label); |
|
|||
22 |
|
24 | |||
23 | this.update(); // Set defaults. |
|
25 | this.update(); // Set defaults. | |
24 | }, |
|
26 | }, | |
@@ -28,7 +30,14 require(["notebook/js/widget"], function(){ | |||||
28 | update : function(){ |
|
30 | update : function(){ | |
29 | if (!this.user_invoked_update) { |
|
31 | if (!this.user_invoked_update) { | |
30 | this.$checkbox.prop('checked', this.model.get('value')); |
|
32 | this.$checkbox.prop('checked', this.model.get('value')); | |
31 | this.$checkbox_label.html(this.model.get('description')); |
|
33 | ||
|
34 | var description = this.model.get('description'); | |||
|
35 | if (description.length == 0) { | |||
|
36 | this.$checkbox_label.hide(); | |||
|
37 | } else { | |||
|
38 | this.$checkbox_label.html(description); | |||
|
39 | this.$checkbox_label.show(); | |||
|
40 | } | |||
32 | } |
|
41 | } | |
33 | return IPython.WidgetView.prototype.update.call(this); |
|
42 | return IPython.WidgetView.prototype.update.call(this); | |
34 | }, |
|
43 | }, | |
@@ -71,7 +80,13 require(["notebook/js/widget"], function(){ | |||||
71 | } else { |
|
80 | } else { | |
72 | this.$button.removeClass('active'); |
|
81 | this.$button.removeClass('active'); | |
73 | } |
|
82 | } | |
74 | this.$button.html(this.model.get('description')); |
|
83 | ||
|
84 | var description = this.model.get('description'); | |||
|
85 | if (description.length == 0) { | |||
|
86 | this.$button.html(' '); // Preserve button height | |||
|
87 | } else { | |||
|
88 | this.$button.html(description); | |||
|
89 | } | |||
75 | } |
|
90 | } | |
76 | return IPython.WidgetView.prototype.update.call(this); |
|
91 | return IPython.WidgetView.prototype.update.call(this); | |
77 | }, |
|
92 | }, |
@@ -22,7 +22,13 require(["notebook/js/widget"], function(){ | |||||
22 | // Handles: Backend -> Frontend Sync |
|
22 | // Handles: Backend -> Frontend Sync | |
23 | // Frontent -> Frontend Sync |
|
23 | // Frontent -> Frontend Sync | |
24 | update : function(){ |
|
24 | update : function(){ | |
25 |
|
|
25 | var description = this.model.get('description'); | |
|
26 | if (description.length==0) { | |||
|
27 | this.$el.html(' '); // Preserve button height | |||
|
28 | } else { | |||
|
29 | this.$el.html(description); | |||
|
30 | } | |||
|
31 | ||||
26 | return IPython.WidgetView.prototype.update.call(this); |
|
32 | return IPython.WidgetView.prototype.update.call(this); | |
27 | }, |
|
33 | }, | |
28 |
|
34 |
@@ -8,6 +8,10 require(["notebook/js/widget"], function(){ | |||||
8 | render : function(){ |
|
8 | render : function(){ | |
9 | this.$el |
|
9 | this.$el | |
10 | .html(''); |
|
10 | .html(''); | |
|
11 | this.$label = $('<div />') | |||
|
12 | .appendTo(this.$el) | |||
|
13 | .addClass('widget-label') | |||
|
14 | .hide(); | |||
11 | this.$slider = $('<div />') |
|
15 | this.$slider = $('<div />') | |
12 | .slider({}) |
|
16 | .slider({}) | |
13 | .addClass('slider'); |
|
17 | .addClass('slider'); | |
@@ -34,6 +38,14 require(["notebook/js/widget"], function(){ | |||||
34 | this.$slider.slider("option", key, this.model.get(key)); |
|
38 | this.$slider.slider("option", key, this.model.get(key)); | |
35 | } |
|
39 | } | |
36 | } |
|
40 | } | |
|
41 | ||||
|
42 | var description = this.model.get('description'); | |||
|
43 | if (description.length == 0) { | |||
|
44 | this.$label.hide(); | |||
|
45 | } else { | |||
|
46 | this.$label.html(description); | |||
|
47 | this.$label.show(); | |||
|
48 | } | |||
37 | return IPython.WidgetView.prototype.update.call(this); |
|
49 | return IPython.WidgetView.prototype.update.call(this); | |
38 | }, |
|
50 | }, | |
39 |
|
51 | |||
@@ -54,6 +66,10 require(["notebook/js/widget"], function(){ | |||||
54 | render : function(){ |
|
66 | render : function(){ | |
55 | this.$el |
|
67 | this.$el | |
56 | .html(''); |
|
68 | .html(''); | |
|
69 | this.$label = $('<div />') | |||
|
70 | .appendTo(this.$el) | |||
|
71 | .addClass('widget-label') | |||
|
72 | .hide(); | |||
57 | this.$textbox = $('<input type="text" />') |
|
73 | this.$textbox = $('<input type="text" />') | |
58 | .addClass('input') |
|
74 | .addClass('input') | |
59 | .appendTo(this.$el); |
|
75 | .appendTo(this.$el); | |
@@ -73,6 +89,14 require(["notebook/js/widget"], function(){ | |||||
73 | } else { |
|
89 | } else { | |
74 | this.$textbox.removeAttr('disabled'); |
|
90 | this.$textbox.removeAttr('disabled'); | |
75 | } |
|
91 | } | |
|
92 | ||||
|
93 | var description = this.model.get('description'); | |||
|
94 | if (description.length == 0) { | |||
|
95 | this.$label.hide(); | |||
|
96 | } else { | |||
|
97 | this.$label.html(description); | |||
|
98 | this.$label.show(); | |||
|
99 | } | |||
76 | return IPython.WidgetView.prototype.update.call(this); |
|
100 | return IPython.WidgetView.prototype.update.call(this); | |
77 | }, |
|
101 | }, | |
78 |
|
102 |
@@ -8,6 +8,10 require(["notebook/js/widget"], function(){ | |||||
8 | render : function(){ |
|
8 | render : function(){ | |
9 | this.$el |
|
9 | this.$el | |
10 | .html(''); |
|
10 | .html(''); | |
|
11 | this.$label = $('<div />') | |||
|
12 | .appendTo(this.$el) | |||
|
13 | .addClass('widget-label') | |||
|
14 | .hide(); | |||
11 | this.$slider = $('<div />') |
|
15 | this.$slider = $('<div />') | |
12 | .slider({}) |
|
16 | .slider({}) | |
13 | .addClass('slider'); |
|
17 | .addClass('slider'); | |
@@ -34,6 +38,14 require(["notebook/js/widget"], function(){ | |||||
34 | this.$slider.slider("option", key, this.model.get(key)); |
|
38 | this.$slider.slider("option", key, this.model.get(key)); | |
35 | } |
|
39 | } | |
36 | } |
|
40 | } | |
|
41 | ||||
|
42 | var description = this.model.get('description'); | |||
|
43 | if (description.length == 0) { | |||
|
44 | this.$label.hide(); | |||
|
45 | } else { | |||
|
46 | this.$label.html(description); | |||
|
47 | this.$label.show(); | |||
|
48 | } | |||
37 | return IPython.WidgetView.prototype.update.call(this); |
|
49 | return IPython.WidgetView.prototype.update.call(this); | |
38 | }, |
|
50 | }, | |
39 |
|
51 | |||
@@ -53,6 +65,10 require(["notebook/js/widget"], function(){ | |||||
53 | render : function(){ |
|
65 | render : function(){ | |
54 | this.$el |
|
66 | this.$el | |
55 | .html(''); |
|
67 | .html(''); | |
|
68 | this.$label = $('<div />') | |||
|
69 | .appendTo(this.$el) | |||
|
70 | .addClass('widget-label') | |||
|
71 | .hide(); | |||
56 | this.$textbox = $('<input type="text" />') |
|
72 | this.$textbox = $('<input type="text" />') | |
57 | .addClass('input') |
|
73 | .addClass('input') | |
58 | .appendTo(this.$el); |
|
74 | .appendTo(this.$el); | |
@@ -72,6 +88,14 require(["notebook/js/widget"], function(){ | |||||
72 | } else { |
|
88 | } else { | |
73 | this.$textbox.removeAttr('disabled'); |
|
89 | this.$textbox.removeAttr('disabled'); | |
74 | } |
|
90 | } | |
|
91 | ||||
|
92 | var description = this.model.get('description'); | |||
|
93 | if (description.length == 0) { | |||
|
94 | this.$label.hide(); | |||
|
95 | } else { | |||
|
96 | this.$label.html(description); | |||
|
97 | this.$label.show(); | |||
|
98 | } | |||
75 | return IPython.WidgetView.prototype.update.call(this); |
|
99 | return IPython.WidgetView.prototype.update.call(this); | |
76 | }, |
|
100 | }, | |
77 |
|
101 |
@@ -9,6 +9,10 require(["notebook/js/widget"], function(){ | |||||
9 |
|
9 | |||
10 | this.$el |
|
10 | this.$el | |
11 | .html(''); |
|
11 | .html(''); | |
|
12 | this.$label = $('<div />') | |||
|
13 | .appendTo(this.$el) | |||
|
14 | .addClass('widget-label') | |||
|
15 | .hide(); | |||
12 | this.$buttongroup = $('<div />') |
|
16 | this.$buttongroup = $('<div />') | |
13 | .addClass('widget_item') |
|
17 | .addClass('widget_item') | |
14 | .addClass('btn-group') |
|
18 | .addClass('btn-group') | |
@@ -42,7 +46,7 require(["notebook/js/widget"], function(){ | |||||
42 | var item_button = $('<a href="#"/>') |
|
46 | var item_button = $('<a href="#"/>') | |
43 | .html(items[index]) |
|
47 | .html(items[index]) | |
44 | .on('click', function(e){ |
|
48 | .on('click', function(e){ | |
45 |
that.model.set('value', $(e.target).html(), this |
|
49 | that.model.set('value', $(e.target).html(), this); | |
46 | that.model.update_other_views(that); |
|
50 | that.model.update_other_views(that); | |
47 | }) |
|
51 | }) | |
48 |
|
52 | |||
@@ -60,6 +64,14 require(["notebook/js/widget"], function(){ | |||||
60 | this.$dropbutton.removeAttr('disabled'); |
|
64 | this.$dropbutton.removeAttr('disabled'); | |
61 | this.$droplist.removeAttr('disabled'); |
|
65 | this.$droplist.removeAttr('disabled'); | |
62 | } |
|
66 | } | |
|
67 | ||||
|
68 | var description = this.model.get('description'); | |||
|
69 | if (description.length == 0) { | |||
|
70 | this.$label.hide(); | |||
|
71 | } else { | |||
|
72 | this.$label.html(description); | |||
|
73 | this.$label.show(); | |||
|
74 | } | |||
63 | return IPython.WidgetView.prototype.update.call(this); |
|
75 | return IPython.WidgetView.prototype.update.call(this); | |
64 | }, |
|
76 | }, | |
65 |
|
77 | |||
@@ -73,6 +85,10 require(["notebook/js/widget"], function(){ | |||||
73 | render : function(){ |
|
85 | render : function(){ | |
74 | this.$el |
|
86 | this.$el | |
75 | .html(''); |
|
87 | .html(''); | |
|
88 | this.$label = $('<div />') | |||
|
89 | .appendTo(this.$el) | |||
|
90 | .addClass('widget-label') | |||
|
91 | .hide(); | |||
76 | this.update(); |
|
92 | this.update(); | |
77 | }, |
|
93 | }, | |
78 |
|
94 | |||
@@ -124,6 +140,14 require(["notebook/js/widget"], function(){ | |||||
124 | $(obj).parent().remove(); |
|
140 | $(obj).parent().remove(); | |
125 | } |
|
141 | } | |
126 | }); |
|
142 | }); | |
|
143 | ||||
|
144 | var description = this.model.get('description'); | |||
|
145 | if (description.length == 0) { | |||
|
146 | this.$label.hide(); | |||
|
147 | } else { | |||
|
148 | this.$label.html(description); | |||
|
149 | this.$label.show(); | |||
|
150 | } | |||
127 | return IPython.WidgetView.prototype.update.call(this); |
|
151 | return IPython.WidgetView.prototype.update.call(this); | |
128 | }, |
|
152 | }, | |
129 |
|
153 | |||
@@ -138,6 +162,10 require(["notebook/js/widget"], function(){ | |||||
138 | render : function(){ |
|
162 | render : function(){ | |
139 | this.$el |
|
163 | this.$el | |
140 | .html(''); |
|
164 | .html(''); | |
|
165 | this.$label = $('<div />') | |||
|
166 | .appendTo(this.$el) | |||
|
167 | .addClass('widget-label') | |||
|
168 | .hide(); | |||
141 | this.$buttongroup = $('<div />') |
|
169 | this.$buttongroup = $('<div />') | |
142 | .addClass('btn-group') |
|
170 | .addClass('btn-group') | |
143 | .attr('data-toggle', 'buttons-radio') |
|
171 | .attr('data-toggle', 'buttons-radio') | |
@@ -189,6 +217,14 require(["notebook/js/widget"], function(){ | |||||
189 | $(obj).remove(); |
|
217 | $(obj).remove(); | |
190 | } |
|
218 | } | |
191 | }); |
|
219 | }); | |
|
220 | ||||
|
221 | var description = this.model.get('description'); | |||
|
222 | if (description.length == 0) { | |||
|
223 | this.$label.hide(); | |||
|
224 | } else { | |||
|
225 | this.$label.html(description); | |||
|
226 | this.$label.show(); | |||
|
227 | } | |||
192 | return IPython.WidgetView.prototype.update.call(this); |
|
228 | return IPython.WidgetView.prototype.update.call(this); | |
193 | }, |
|
229 | }, | |
194 |
|
230 |
@@ -27,6 +27,10 require(["notebook/js/widget"], function(){ | |||||
27 | render : function(){ |
|
27 | render : function(){ | |
28 | this.$el |
|
28 | this.$el | |
29 | .html(''); |
|
29 | .html(''); | |
|
30 | this.$label = $('<div />') | |||
|
31 | .appendTo(this.$el) | |||
|
32 | .addClass('widget-label') | |||
|
33 | .hide(); | |||
30 | this.$textbox = $('<textarea />') |
|
34 | this.$textbox = $('<textarea />') | |
31 | .attr('rows', 5) |
|
35 | .attr('rows', 5) | |
32 | .appendTo(this.$el); |
|
36 | .appendTo(this.$el); | |
@@ -39,6 +43,14 require(["notebook/js/widget"], function(){ | |||||
39 | if (!this.user_invoked_update) { |
|
43 | if (!this.user_invoked_update) { | |
40 | this.$textbox.val(this.model.get('value')); |
|
44 | this.$textbox.val(this.model.get('value')); | |
41 | } |
|
45 | } | |
|
46 | ||||
|
47 | var description = this.model.get('description'); | |||
|
48 | if (description.length == 0) { | |||
|
49 | this.$label.hide(); | |||
|
50 | } else { | |||
|
51 | this.$label.html(description); | |||
|
52 | this.$label.show(); | |||
|
53 | } | |||
42 | return IPython.WidgetView.prototype.update.call(this); |
|
54 | return IPython.WidgetView.prototype.update.call(this); | |
43 | }, |
|
55 | }, | |
44 |
|
56 | |||
@@ -63,6 +75,10 require(["notebook/js/widget"], function(){ | |||||
63 | render : function(){ |
|
75 | render : function(){ | |
64 | this.$el |
|
76 | this.$el | |
65 | .html(''); |
|
77 | .html(''); | |
|
78 | this.$label = $('<div />') | |||
|
79 | .addClass('widget-label') | |||
|
80 | .appendTo(this.$el) | |||
|
81 | .hide(); | |||
66 | this.$textbox = $('<input type="text" />') |
|
82 | this.$textbox = $('<input type="text" />') | |
67 | .addClass('input') |
|
83 | .addClass('input') | |
68 | .appendTo(this.$el); |
|
84 | .appendTo(this.$el); | |
@@ -75,6 +91,14 require(["notebook/js/widget"], function(){ | |||||
75 | if (!this.user_invoked_update) { |
|
91 | if (!this.user_invoked_update) { | |
76 | this.$textbox.val(this.model.get('value')); |
|
92 | this.$textbox.val(this.model.get('value')); | |
77 | } |
|
93 | } | |
|
94 | ||||
|
95 | var description = this.model.get('description'); | |||
|
96 | if (description.length == 0) { | |||
|
97 | this.$label.hide(); | |||
|
98 | } else { | |||
|
99 | this.$label.html(description); | |||
|
100 | this.$label.show(); | |||
|
101 | } | |||
78 | return IPython.WidgetView.prototype.update.call(this); |
|
102 | return IPython.WidgetView.prototype.update.call(this); | |
79 | }, |
|
103 | }, | |
80 |
|
104 |
@@ -24,6 +24,7 class FloatWidget(Widget): | |||||
24 | default_view_name = Unicode('FloatTextView') |
|
24 | default_view_name = Unicode('FloatTextView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | _keys = ['value', 'disabled'] |
|
27 | _keys = ['value', 'disabled', 'description'] | |
28 | value = Float(0.0, help="Float value") |
|
28 | value = Float(0.0, help="Float value") | |
29 | disabled = Bool(False, help="Enable or disable user changes") |
|
29 | disabled = Bool(False, help="Enable or disable user changes") | |
|
30 | description = Unicode(help="Description of the value this widget represents") |
@@ -24,10 +24,11 class FloatRangeWidget(Widget): | |||||
24 | default_view_name = Unicode('FloatSliderView') |
|
24 | default_view_name = Unicode('FloatSliderView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation'] |
|
27 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] | |
28 | value = Float(0.0, help="Flaot value") |
|
28 | value = Float(0.0, help="Flaot value") | |
29 | max = Float(100.0, help="Max value") |
|
29 | max = Float(100.0, help="Max value") | |
30 | min = Float(0.0, help="Min value") |
|
30 | min = Float(0.0, help="Min value") | |
31 | disabled = Bool(False, help="Enable or disable user changes") |
|
31 | disabled = Bool(False, help="Enable or disable user changes") | |
32 | step = Float(0.1, help="Minimum step that the value can take (ignored by some views)") |
|
32 | step = Float(0.1, help="Minimum step that the value can take (ignored by some views)") | |
33 | orientation = Unicode(u'horizontal', help="Vertical or horizontal (ignored by some views)") |
|
33 | orientation = Unicode(u'horizontal', help="Vertical or horizontal (ignored by some views)") | |
|
34 | description = Unicode(help="Description of the value this widget represents") |
@@ -24,6 +24,7 class IntWidget(Widget): | |||||
24 | default_view_name = Unicode('IntTextView') |
|
24 | default_view_name = Unicode('IntTextView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | _keys = ['value', 'disabled'] |
|
27 | _keys = ['value', 'disabled', 'description'] | |
28 | value = Int(0, help="Int value") |
|
28 | value = Int(0, help="Int value") | |
29 | disabled = Bool(False, help="Enable or disable user changes") |
|
29 | disabled = Bool(False, help="Enable or disable user changes") | |
|
30 | description = Unicode(help="Description of the value this widget represents") |
@@ -24,10 +24,11 class IntRangeWidget(Widget): | |||||
24 | default_view_name = Unicode('IntSliderView') |
|
24 | default_view_name = Unicode('IntSliderView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation'] |
|
27 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] | |
28 | value = Int(0, help="Int value") |
|
28 | value = Int(0, help="Int value") | |
29 | max = Int(100, help="Max value") |
|
29 | max = Int(100, help="Max value") | |
30 | min = Int(0, help="Min value") |
|
30 | min = Int(0, help="Min value") | |
31 | disabled = Bool(False, help="Enable or disable user changes") |
|
31 | disabled = Bool(False, help="Enable or disable user changes") | |
32 | step = Int(1, help="Minimum step that the value can take (ignored by some views)") |
|
32 | step = Int(1, help="Minimum step that the value can take (ignored by some views)") | |
33 | orientation = Unicode(u'horizontal', help="Vertical or horizontal (ignored by some views)") |
|
33 | orientation = Unicode(u'horizontal', help="Vertical or horizontal (ignored by some views)") | |
|
34 | description = Unicode(help="Description of the value this widget represents") |
@@ -24,8 +24,9 class SelectionWidget(Widget): | |||||
24 | default_view_name = Unicode('DropdownView') |
|
24 | default_view_name = Unicode('DropdownView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | _keys = ['value', 'values', 'disabled'] |
|
27 | _keys = ['value', 'values', 'disabled', 'description'] | |
28 | value = Unicode(help="Selected value") |
|
28 | value = Unicode(help="Selected value") | |
29 | values = List(help="List of values the user can select") |
|
29 | values = List(help="List of values the user can select") | |
30 | disabled = Bool(False, help="Enable or disable user changes") |
|
30 | disabled = Bool(False, help="Enable or disable user changes") | |
|
31 | description = Unicode(help="Description of the value this widget represents") | |||
31 | No newline at end of file |
|
32 |
@@ -24,6 +24,7 class StringWidget(Widget): | |||||
24 | default_view_name = Unicode('TextBoxView') |
|
24 | default_view_name = Unicode('TextBoxView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | _keys = ['value', 'disabled'] |
|
27 | _keys = ['value', 'disabled', 'description'] | |
28 | value = Unicode(help="String value") |
|
28 | value = Unicode(help="String value") | |
29 | disabled = Bool(False, help="Enable or disable user changes") |
|
29 | disabled = Bool(False, help="Enable or disable user changes") | |
|
30 | description = Unicode(help="Description of the value this widget represents") |
General Comments 0
You need to be logged in to leave comments.
Login now