Skip to content

Commit

Permalink
not print _ColormakerRegistry in non-noteook context (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm authored Jun 20, 2020
1 parent dccabf2 commit 146dd30
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nglview/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
try:
get_ipython() # only display in notebook
display(self)
self._ipython_display_()
except NameError:
pass

Expand All @@ -53,6 +53,11 @@ def _ipython_display_(self, **kwargs):
return
super()._ipython_display_(**kwargs)

def __repr__(self):
# Prevent ipywidgets to print _ColormakerRegistry() in non-notebook
# context
return ""

def add_selection_scheme(self, scheme_id, arg):
"""
Examples
Expand Down

0 comments on commit 146dd30

Please sign in to comment.