Skip to content

Commit

Permalink
Ianhelle/widget fix 2020 09 25 (#104)
Browse files Browse the repository at this point in the history
* Fixed widget throwing exception if env var is set.

* Updating version
  • Loading branch information
ianhelle committed Sep 26, 2020
1 parent 68b52d4 commit 82e6f11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion msticpy/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Version file."""
VERSION = "0.8.1"
VERSION = "0.8.2"
5 changes: 4 additions & 1 deletion msticpy/nbtools/nbwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ def __init__(
"""
env_val = os.environ.get(env_var)
self._name = env_var
self._value = ""

# Call superclass to register
super().__init__(id_vals=[env_var, prompt], val_attrs=["_value"], **kwargs)
Expand All @@ -748,6 +749,7 @@ def __init__(
# variable is set override with this value.
if env_val is not None:
self._value = env_val

if not self._value and help_str is not None:
display(widgets.HTML(value=help_str))

Expand Down Expand Up @@ -790,8 +792,9 @@ def display(self):

def _on_save_button_clicked(self, button):
del button
self._value = self._w_text.value.strip()
if self._w_check_save.value:
os.environ[self._name] = self._w_text.value.strip()
os.environ[self._name] = self._value

def _ipython_display_(self):
"""Display in IPython."""
Expand Down

0 comments on commit 82e6f11

Please sign in to comment.