diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py index dfc116949..4c485c92e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py @@ -601,12 +601,11 @@ def set_coordinates(self, frame: int): # Update the view. self.update_renderer() - def set_reader(self, reader, frame=0): + def set_reader(self, reader): """Set the trajectory at a given frame Args: reader (IReader): the trajectory object - frame (int): the selected frame """ if (self._reader is not None) and (reader.filename == self._reader.filename): @@ -619,8 +618,7 @@ def set_reader(self, reader, frame=0): self._n_atoms = self._reader.n_atoms self._n_frames = self._reader.n_frames - - self.new_max_frames.emit(self._n_frames - 1) + self._current_frame = min(self._current_frame, self._n_frames - 1) self._atoms = self._reader.atom_types @@ -648,8 +646,8 @@ def set_reader(self, reader, frame=0): self.reset_all_polydata() self._polydata.GetPointData().SetScalars(scalars) - self._current_frame = frame self._colour_manager.onNewValues() + self.new_max_frames.emit(self._n_frames - 1) @Slot(object) def take_atom_properties(self, data): @@ -657,8 +655,8 @@ def take_atom_properties(self, data): scalars = ndarray_to_vtkarray(colours, radii, numbers) self._polydata = vtk.vtkPolyData() self._polydata.GetPointData().SetScalars(scalars) - self.set_coordinates(self._current_frame) - + self.update_all_polydata() + self.update_renderer() # self._datamodel.setReader(reader) def update_renderer(self):