##// END OF EJS Templates
Cleaned up python widget classes
Jonathan Frederic -
Show More
@@ -1,15 +1,12 b''
1 import os
2
3 from base import Widget
1 from base import Widget
4 from IPython.utils.traitlets import Unicode, Bool, List
2 from IPython.utils.traitlets import Unicode, Bool, List
5
3
6 class BoolWidget(Widget):
4 class BoolWidget(Widget):
7 target_name = Unicode('BoolWidgetModel')
5 target_name = Unicode('BoolWidgetModel')
8 default_view_name = Unicode('CheckboxView')
6 default_view_name = Unicode('CheckboxView')
9 js_requirements = List(["static/notebook/js/widgets/bool.js"])
10 _keys = ['value', 'description', 'disabled']
7 _keys = ['value', 'description', 'disabled']
11
8
12 value = Bool(False)
9 value = Bool(False)
13 description = Unicode('') # Description of the boolean (label).
10 description = Unicode('') # Description of the boolean (label).
14 disabled = Bool(False) # Enable or disable user changes
11 disabled = Bool(False) # Enable or disable user changes
15 No newline at end of file
12
@@ -1,12 +1,7 b''
1 import os
2
3 from base import Widget
1 from base import Widget
4 from IPython.utils.traitlets import Unicode, List
2 from IPython.utils.traitlets import Unicode
5 from IPython.utils.javascript import display_all_js
6
3
7 class ContainerWidget(Widget):
4 class ContainerWidget(Widget):
8 target_name = Unicode('container_widget')
5 target_name = Unicode('container_widget')
9 default_view_name = Unicode('ContainerView')
6 default_view_name = Unicode('ContainerView')
10 js_requirements = List(["static/notebook/js/widgets/container.js"])
7 No newline at end of file
11
12 _keys = []
@@ -1,18 +1,14 b''
1 import os
2
3 from base import Widget
1 from base import Widget
4 from IPython.utils.traitlets import Unicode, Float, Bool, List
2 from IPython.utils.traitlets import Unicode, Float, Bool, List
5 from IPython.utils.javascript import display_all_js
6
3
7 class FloatRangeWidget(Widget):
4 class FloatRangeWidget(Widget):
8 target_name = Unicode('FloatRangeWidgetModel')
5 target_name = Unicode('FloatRangeWidgetModel')
9 default_view_name = Unicode('FloatSliderView')
6 default_view_name = Unicode('FloatSliderView')
10 js_requirements = List(["static/notebook/js/widgets/float_range.js"])
11 _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation']
7 _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation']
12
8
13 value = Float(0.0)
9 value = Float(0.0)
14 max = Float(100.0) # Max value
10 max = Float(100.0) # Max value
15 min = Float(0.0) # Min value
11 min = Float(0.0) # Min value
16 disabled = Bool(False) # Enable or disable user changes
12 disabled = Bool(False) # Enable or disable user changes
17 step = Float(0.1) # Minimum step that the value can take (ignored by some views)
13 step = Float(0.1) # Minimum step that the value can take (ignored by some views)
18 orientation = Unicode(u'horizontal') # Vertical or horizontal (ignored by some views)
14 orientation = Unicode(u'horizontal') # Vertical or horizontal (ignored by some views)
@@ -1,18 +1,14 b''
1 import os
2
3 from base import Widget
1 from base import Widget
4 from IPython.utils.traitlets import Unicode, Int, Bool, List
2 from IPython.utils.traitlets import Unicode, Int, Bool, List
5 from IPython.utils.javascript import display_all_js
6
3
7 class IntRangeWidget(Widget):
4 class IntRangeWidget(Widget):
8 target_name = Unicode('IntRangeWidgetModel')
5 target_name = Unicode('IntRangeWidgetModel')
9 default_view_name = Unicode('IntSliderView')
6 default_view_name = Unicode('IntSliderView')
10 js_requirements = List(["static/notebook/js/widgets/int_range.js"])
11 _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation']
7 _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation']
12
8
13 value = Int(0)
9 value = Int(0)
14 max = Int(100) # Max value
10 max = Int(100) # Max value
15 min = Int(0) # Min value
11 min = Int(0) # Min value
16 disabled = Bool(False) # Enable or disable user changes
12 disabled = Bool(False) # Enable or disable user changes
17 step = Int(1) # Minimum step that the value can take (ignored by some views)
13 step = Int(1) # Minimum step that the value can take (ignored by some views)
18 orientation = Unicode(u'horizontal') # Vertical or horizontal (ignored by some views)
14 orientation = Unicode(u'horizontal') # Vertical or horizontal (ignored by some views)
@@ -1,16 +1,12 b''
1 import os
2
3 from base import Widget
1 from base import Widget
4 from IPython.utils.traitlets import Unicode, List, Bool
2 from IPython.utils.traitlets import Unicode, List, Bool
5 from IPython.utils.javascript import display_all_js
6
3
7 class SelectionWidget(Widget):
4 class SelectionWidget(Widget):
8 target_name = Unicode('SelectionWidgetModel')
5 target_name = Unicode('SelectionWidgetModel')
9 default_view_name = Unicode('DropdownView')
6 default_view_name = Unicode('DropdownView')
10 js_requirements = List(["static/notebook/js/widgets/selection.js"])
11 _keys = ['value', 'values', 'disabled']
7 _keys = ['value', 'values', 'disabled']
12
8
13 value = Unicode()
9 value = Unicode()
14 values = List() # List of values the user can select
10 values = List() # List of values the user can select
15 disabled = Bool(False) # Enable or disable user changes
11 disabled = Bool(False) # Enable or disable user changes
16 No newline at end of file
12
@@ -1,15 +1,11 b''
1 import os
2
3 from base import Widget
1 from base import Widget
4 from IPython.utils.traitlets import Unicode, Bool, List
2 from IPython.utils.traitlets import Unicode, Bool, List
5 from IPython.utils.javascript import display_all_js
6
3
7 class StringWidget(Widget):
4 class StringWidget(Widget):
8 target_name = Unicode('StringWidgetModel')
5 target_name = Unicode('StringWidgetModel')
9 default_view_name = Unicode('TextboxView')
6 default_view_name = Unicode('TextboxView')
10 js_requirements = List(["static/notebook/js/widgets/string.js"])
7 _keys = ['value', 'disabled']
11 _keys = ['value', 'row_count', 'disabled']
12
8
13 value = Unicode()
9 value = Unicode()
14 disabled = Bool(False) # Enable or disable user changes
10 disabled = Bool(False) # Enable or disable user changes
15 No newline at end of file
11
General Comments 0
You need to be logged in to leave comments. Login now