Show More
@@ -9,4 +9,4 b' from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, In' | |||||
9 | from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, SelectWidget |
|
9 | from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, SelectWidget | |
10 | from .widget_selectioncontainer import TabWidget, AccordionWidget |
|
10 | from .widget_selectioncontainer import TabWidget, AccordionWidget | |
11 | from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget |
|
11 | from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget | |
12 |
from .interaction import interact, interactive, |
|
12 | from .interaction import interact, interactive, fixed |
@@ -107,7 +107,7 b' def _widget_abbrev(o):' | |||||
107 |
|
107 | |||
108 | def _widget_from_abbrev(abbrev): |
|
108 | def _widget_from_abbrev(abbrev): | |
109 | """Build a Widget intstance given an abbreviation or Widget.""" |
|
109 | """Build a Widget intstance given an abbreviation or Widget.""" | |
110 |
if isinstance(abbrev, Widget) or isinstance(abbrev, |
|
110 | if isinstance(abbrev, Widget) or isinstance(abbrev, fixed): | |
111 | return abbrev |
|
111 | return abbrev | |
112 |
|
112 | |||
113 | widget = _widget_abbrev(abbrev) |
|
113 | widget = _widget_abbrev(abbrev) | |
@@ -190,7 +190,7 b' def interactive(__interact_f, **kwargs):' | |||||
190 | kwargs_widgets.extend(_widgets_from_abbreviations(sorted(kwargs.items(), key = lambda x: x[0]))) |
|
190 | kwargs_widgets.extend(_widgets_from_abbreviations(sorted(kwargs.items(), key = lambda x: x[0]))) | |
191 |
|
191 | |||
192 | # This has to be done as an assignment, not using container.children.append, |
|
192 | # This has to be done as an assignment, not using container.children.append, | |
193 |
# so that traitlets notices the update. We skip any objects (such as |
|
193 | # so that traitlets notices the update. We skip any objects (such as fixed) that | |
194 | # are not DOMWidgets. |
|
194 | # are not DOMWidgets. | |
195 | c = [w for w in kwargs_widgets if isinstance(w, DOMWidget)] |
|
195 | c = [w for w in kwargs_widgets if isinstance(w, DOMWidget)] | |
196 | container.children = c |
|
196 | container.children = c | |
@@ -240,9 +240,9 b' def interact(__interact_f=None, **kwargs):' | |||||
240 | return f |
|
240 | return f | |
241 | return dec |
|
241 | return dec | |
242 |
|
242 | |||
243 |
class |
|
243 | class fixed(HasTraits): | |
244 |
"""A pseudo-widget whose value is |
|
244 | """A pseudo-widget whose value is fixed and never synced to the client.""" | |
245 | value = Any(help="Any Python object") |
|
245 | value = Any(help="Any Python object") | |
246 | description = Unicode('', help="Any Python object") |
|
246 | description = Unicode('', help="Any Python object") | |
247 | def __init__(self, value, **kwargs): |
|
247 | def __init__(self, value, **kwargs): | |
248 |
super( |
|
248 | super(fixed, self).__init__(value=value, **kwargs) |
General Comments 0
You need to be logged in to leave comments.
Login now