From fbdd3255d2c15cc48e3fccd5722f101183297b43 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Date: Fri, 22 Nov 2024 14:05:09 -0500 Subject: [PATCH] more --- nglview/tests/test_widget.py | 9 +++++++-- nglview/widget.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nglview/tests/test_widget.py b/nglview/tests/test_widget.py index bfcd0691..9f0db547 100644 --- a/nglview/tests/test_widget.py +++ b/nglview/tests/test_widget.py @@ -88,9 +88,14 @@ def get_mocked_traj(): - class MockedTraj(nv.Structure): + class MockedTraj(nv.Structure, nv.Trajectory): def __init__(self): - self.n_frames = 10 + nv.Structure.__init__(self) + nv.Trajectory.__init__(self) + + @property + def n_frames(self): + return 10 def get_coordinates(self, frame): return np.random.rand(10, 3, 3) diff --git a/nglview/widget.py b/nglview/widget.py index da9ae991..864c4ed5 100644 --- a/nglview/widget.py +++ b/nglview/widget.py @@ -691,7 +691,7 @@ def set_coordinates(self, arr_dict, movie_making=False, def _on_frame_changed(self, change): """set and send coordinates at current frame """ - self._set_coordinates(self.frame) + self._set_coordinates(change['new']) def clear(self, *args, **kwargs): '''shortcut of `clear_representations`