Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Jan 23, 2025
1 parent 53daa83 commit 6a834e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions nglview/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class NGLWidget(WidgetBase):
_model_name = Unicode("NGLModel").tag(sync=True)
_ngl_version = Unicode().tag(sync=True)

# View and model attributes
# View and model attributes
_image_data = Unicode().tag(sync=False)
_view_width = Unicode().tag(sync=True) # px
_view_height = Unicode().tag(sync=True) # px
Expand All @@ -143,12 +143,10 @@ class NGLWidget(WidgetBase):
_ngl_repr_dict = Dict().tag(sync=True)
_ngl_component_ids = List().tag(sync=False)
_ngl_component_names = List().tag(sync=False)
_ngl_msg = None
_send_binary = Bool(True).tag(sync=False)
_init_gui = Bool(False).tag(sync=False)
gui_style = CaselessStrEnum(['ngl'], allow_none=True).tag(sync=True)
_gui_theme = CaselessStrEnum(['dark', 'light'], allow_none=True).tag(sync=True)
_widget_theme = None

# Frame and background attributes
frame = Integer().tag(sync=True)
Expand Down Expand Up @@ -184,6 +182,8 @@ def __init__(self,
parameters=None,
**kwargs):
super().__init__(structure=structure, representations=representations, parameters=parameters, **kwargs)
self._ngl_msg = None
self._widget_theme = None
self._initialize_attributes(kwargs)
self._initialize_threads()
self._initialize_components(structure, representations, parameters, kwargs)
Expand Down
5 changes: 2 additions & 3 deletions nglview/widget_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ class WidgetBase(widgets.DOMWidget):

frame = Integer().tag(sync=True)
loaded = Bool(False).tag(sync=False)
_component_ids = []
_callbacks_before_loaded = []
_event = threading.Event()

def __init__(self, **kwargs):
# Extract recognized arguments
recognized_kwargs = {k: v for k, v in kwargs.items() if k in self.trait_names()}
super().__init__(**recognized_kwargs)
self._view_component_ids = []
self._callbacks_before_loaded = []
self._event = threading.Event()
self._trajlist = []
self._initialize_threads()

Expand Down

0 comments on commit 6a834e7

Please sign in to comment.