mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
s/const/fixed/
This commit is contained in:
parent
2d2c5beb0e
commit
a58ca8a0a0
@ -9,4 +9,4 @@ from .widget_int import IntTextWidget, BoundedIntTextWidget, IntSliderWidget, In
|
||||
from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownWidget, SelectWidget
|
||||
from .widget_selectioncontainer import TabWidget, AccordionWidget
|
||||
from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget
|
||||
from .interaction import interact, interactive, const
|
||||
from .interaction import interact, interactive, fixed
|
||||
|
@ -107,7 +107,7 @@ def _widget_abbrev(o):
|
||||
|
||||
def _widget_from_abbrev(abbrev):
|
||||
"""Build a Widget intstance given an abbreviation or Widget."""
|
||||
if isinstance(abbrev, Widget) or isinstance(abbrev, const):
|
||||
if isinstance(abbrev, Widget) or isinstance(abbrev, fixed):
|
||||
return abbrev
|
||||
|
||||
widget = _widget_abbrev(abbrev)
|
||||
@ -190,7 +190,7 @@ def interactive(__interact_f, **kwargs):
|
||||
kwargs_widgets.extend(_widgets_from_abbreviations(sorted(kwargs.items(), key = lambda x: x[0])))
|
||||
|
||||
# This has to be done as an assignment, not using container.children.append,
|
||||
# so that traitlets notices the update. We skip any objects (such as const) that
|
||||
# so that traitlets notices the update. We skip any objects (such as fixed) that
|
||||
# are not DOMWidgets.
|
||||
c = [w for w in kwargs_widgets if isinstance(w, DOMWidget)]
|
||||
container.children = c
|
||||
@ -240,9 +240,9 @@ def interact(__interact_f=None, **kwargs):
|
||||
return f
|
||||
return dec
|
||||
|
||||
class const(HasTraits):
|
||||
"""A pseudo-widget whose value is constant and never client synced."""
|
||||
class fixed(HasTraits):
|
||||
"""A pseudo-widget whose value is fixed and never synced to the client."""
|
||||
value = Any(help="Any Python object")
|
||||
description = Unicode('', help="Any Python object")
|
||||
def __init__(self, value, **kwargs):
|
||||
super(const, self).__init__(value=value, **kwargs)
|
||||
super(fixed, self).__init__(value=value, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user