diff --git a/src/ipyautoui/autowidgets.py b/src/ipyautoui/autowidgets.py index 720a4eaf..a113e3fa 100644 --- a/src/ipyautoui/autowidgets.py +++ b/src/ipyautoui/autowidgets.py @@ -115,6 +115,7 @@ def __init__(self, widget_type, schema, *args, **kwargs): super().__init__([self.bn, self.widget, self.show_none]) self._init_controls() self.value = value + self._set_disabled() def _init_trait(self): # NOTE: see test for add_traits that demos usage -@jovyan at 7/18/2022, 12:11:39 PM @@ -165,6 +166,11 @@ def _toggle_none(self, onchange): self.show_none.layout.display = "None" self.value = self.widget.value + def _set_disabled(self): + """If disabled in schema, set to value defined.""" + if "disabled" in self.schema: + self.disabled = self.schema["disabled"] + def nullable(fn, **kwargs): """extend a simple widget to allow None