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`