Show More
@@ -36,7 +36,7 b' class Widget(LoggingConfigurable):' | |||||
36 | # Shared declarations (Class level) |
|
36 | # Shared declarations (Class level) | |
37 | widget_construction_callback = None |
|
37 | widget_construction_callback = None | |
38 |
|
38 | |||
39 |
keys = [' |
|
39 | keys = ['view_name'] | |
40 |
|
40 | |||
41 | def on_widget_constructed(callback): |
|
41 | def on_widget_constructed(callback): | |
42 | """Class method, registers a callback to be called when a widget is |
|
42 | """Class method, registers a callback to be called when a widget is | |
@@ -54,7 +54,7 b' class Widget(LoggingConfigurable):' | |||||
54 | # Public declarations (Instance level) |
|
54 | # Public declarations (Instance level) | |
55 | target_name = Unicode('widget', help="""Name of the backbone model |
|
55 | target_name = Unicode('widget', help="""Name of the backbone model | |
56 | registered in the frontend to create and sync this widget with.""") |
|
56 | registered in the frontend to create and sync this widget with.""") | |
57 |
|
|
57 | view_name = Unicode(help="""Default view registered in the frontend | |
58 | to use to represent the widget.""") |
|
58 | to use to represent the widget.""") | |
59 |
|
59 | |||
60 | # Private/protected declarations |
|
60 | # Private/protected declarations | |
@@ -276,8 +276,8 b' class Widget(LoggingConfigurable):' | |||||
276 | Parameters |
|
276 | Parameters | |
277 | ---------- |
|
277 | ---------- | |
278 | view_name: unicode (optional) |
|
278 | view_name: unicode (optional) | |
279 |
View to display in the frontend. Overrides |
|
279 | View to display in the frontend. Overrides view_name.""" | |
280 |
view_name = kwargs.get('view_name', self. |
|
280 | view_name = kwargs.get('view_name', self.view_name) | |
281 |
|
281 | |||
282 | # Create a communication. |
|
282 | # Create a communication. | |
283 | self._open_communication() |
|
283 | self._open_communication() |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, Bool, List' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class BoolWidget(DOMWidget): |
|
22 | class BoolWidget(DOMWidget): | |
23 | target_name = Unicode('BoolWidgetModel') |
|
23 | target_name = Unicode('BoolWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('CheckboxView') | |
25 |
|
25 | |||
26 | # Model Keys |
|
26 | # Model Keys | |
27 | keys = ['value', 'description', 'disabled'] + DOMWidget.keys |
|
27 | keys = ['value', 'description', 'disabled'] + DOMWidget.keys |
@@ -25,7 +25,7 b' from IPython.utils.traitlets import Unicode, Bool, Int' | |||||
25 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
26 | class ButtonWidget(DOMWidget): |
|
26 | class ButtonWidget(DOMWidget): | |
27 | target_name = Unicode('ButtonWidgetModel') |
|
27 | target_name = Unicode('ButtonWidgetModel') | |
28 |
|
|
28 | view_name = Unicode('ButtonView') | |
29 |
|
29 | |||
30 | # Keys |
|
30 | # Keys | |
31 | keys = ['description', 'disabled'] + DOMWidget.keys |
|
31 | keys = ['description', 'disabled'] + DOMWidget.keys |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, Bool, List, Instance' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class ContainerWidget(DOMWidget): |
|
22 | class ContainerWidget(DOMWidget): | |
23 | target_name = Unicode('ContainerWidgetModel') |
|
23 | target_name = Unicode('ContainerWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('ContainerView') | |
25 |
|
25 | |||
26 | # Keys, all private and managed by helper methods. Flexible box model |
|
26 | # Keys, all private and managed by helper methods. Flexible box model | |
27 | # classes... |
|
27 | # classes... |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, Float, Bool, List' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class FloatWidget(DOMWidget): |
|
22 | class FloatWidget(DOMWidget): | |
23 | target_name = Unicode('FloatWidgetModel') |
|
23 | target_name = Unicode('FloatWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('FloatTextView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | keys = ['value', 'disabled', 'description'] + DOMWidget.keys |
|
27 | keys = ['value', 'disabled', 'description'] + DOMWidget.keys |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, Float, Bool, List' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class FloatRangeWidget(DOMWidget): |
|
22 | class FloatRangeWidget(DOMWidget): | |
23 | target_name = Unicode('FloatRangeWidgetModel') |
|
23 | target_name = Unicode('FloatRangeWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('FloatSliderView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + DOMWidget.keys |
|
27 | keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + DOMWidget.keys |
@@ -24,7 +24,7 b' from IPython.utils.traitlets import Unicode, Bytes' | |||||
24 | #----------------------------------------------------------------------------- |
|
24 | #----------------------------------------------------------------------------- | |
25 | class ImageWidget(DOMWidget): |
|
25 | class ImageWidget(DOMWidget): | |
26 | target_name = Unicode('ImageWidgetModel') |
|
26 | target_name = Unicode('ImageWidgetModel') | |
27 |
|
|
27 | view_name = Unicode('ImageView') | |
28 |
|
28 | |||
29 | # Define the custom state properties to sync with the front-end |
|
29 | # Define the custom state properties to sync with the front-end | |
30 | keys = ['image_format', 'width', 'height', '_b64value'] + DOMWidget.keys |
|
30 | keys = ['image_format', 'width', 'height', '_b64value'] + DOMWidget.keys |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, Int, Bool, List' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class IntWidget(DOMWidget): |
|
22 | class IntWidget(DOMWidget): | |
23 | target_name = Unicode('IntWidgetModel') |
|
23 | target_name = Unicode('IntWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('IntTextView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | keys = ['value', 'disabled', 'description'] + DOMWidget.keys |
|
27 | keys = ['value', 'disabled', 'description'] + DOMWidget.keys |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, Int, Bool, List' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class IntRangeWidget(DOMWidget): |
|
22 | class IntRangeWidget(DOMWidget): | |
23 | target_name = Unicode('IntRangeWidgetModel') |
|
23 | target_name = Unicode('IntRangeWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('IntSliderView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + DOMWidget.keys |
|
27 | keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation', 'description'] + DOMWidget.keys |
@@ -22,7 +22,7 b' from IPython.utils.traitlets import Unicode, Dict, Int, List, Instance' | |||||
22 | #----------------------------------------------------------------------------- |
|
22 | #----------------------------------------------------------------------------- | |
23 | class MulticontainerWidget(DOMWidget): |
|
23 | class MulticontainerWidget(DOMWidget): | |
24 | target_name = Unicode('MulticontainerWidgetModel') |
|
24 | target_name = Unicode('MulticontainerWidgetModel') | |
25 |
|
|
25 | view_name = Unicode('TabView') | |
26 |
|
26 | |||
27 | # Keys |
|
27 | # Keys | |
28 | keys = ['_titles', 'selected_index', 'children'] + DOMWidget.keys |
|
28 | keys = ['_titles', 'selected_index', 'children'] + DOMWidget.keys |
@@ -21,7 +21,7 b' from IPython.utils.traitlets import Unicode, List, Bool' | |||||
21 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
22 | class SelectionWidget(DOMWidget): |
|
22 | class SelectionWidget(DOMWidget): | |
23 | target_name = Unicode('SelectionWidgetModel') |
|
23 | target_name = Unicode('SelectionWidgetModel') | |
24 |
|
|
24 | view_name = Unicode('DropdownView') | |
25 |
|
25 | |||
26 | # Keys |
|
26 | # Keys | |
27 | keys = ['value', 'values', 'disabled', 'description'] + DOMWidget.keys |
|
27 | keys = ['value', 'values', 'disabled', 'description'] + DOMWidget.keys |
@@ -24,7 +24,7 b' from IPython.utils.traitlets import Unicode, Bool, List, Int' | |||||
24 | #----------------------------------------------------------------------------- |
|
24 | #----------------------------------------------------------------------------- | |
25 | class StringWidget(DOMWidget): |
|
25 | class StringWidget(DOMWidget): | |
26 | target_name = Unicode('StringWidgetModel') |
|
26 | target_name = Unicode('StringWidgetModel') | |
27 |
|
|
27 | view_name = Unicode('TextBoxView') | |
28 |
|
28 | |||
29 | # Keys |
|
29 | # Keys | |
30 | keys = ['value', 'disabled', 'description'] + DOMWidget.keys |
|
30 | keys = ['value', 'disabled', 'description'] + DOMWidget.keys |
General Comments 0
You need to be logged in to leave comments.
Login now