Skip to content

Commit

Permalink
Merge pull request #32 from ssciwr/correct-resetting
Browse files Browse the repository at this point in the history
Correct resetting
  • Loading branch information
dokempf authored Mar 3, 2022
2 parents ae1fcb7 + 47e9657 commit 24010d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ipywidgets_jsonschema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ipywidgets_jsonschema.form import Form

__version__ = "0.7.2"
__version__ = "0.7.3"
8 changes: 6 additions & 2 deletions ipywidgets_jsonschema/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,11 @@ def _construct_object(self, schema, label=None, root=False):
widget_list = self._wrap_accordion(widget_list, schema, label=label)

def _setter(_d):
for k, v in _d.items():
elements[k].setter(v)
for k in schema["properties"].keys():
if k in _d:
elements[k].setter(_d[k])
else:
elements[k].resetter()

def _register_observer(h, n, t):
for e in elements.values():
Expand Down Expand Up @@ -304,6 +307,7 @@ def _resetter():
if "default" in schema:
widget.value = schema["default"]
else:
widget.value = widget.trait_defaults()["value"]
if "minimum" in schema:
widget.value = schema["minimum"]
if "maximum" in schema:
Expand Down

0 comments on commit 24010d6

Please sign in to comment.