superstar54 / weas-widget

A widget to visualize and edit atomic structures in Jupyter Notebook
https://weas-widget.readthedocs.io/en/latest/index.html
MIT License
19 stars 3 forks source link

update viewer if atoms has a different uuid #26

Closed superstar54 closed 6 months ago

superstar54 commented 6 months ago

When a new atoms is passed from Python to the viewer, it will first check the uuid of the atoms and the uuid of the atoms in the viewer. Update the viewer and its plugins only when the uuids are different.

Here is the message chain, when user edit the atoms in the GUI.

1) users edit the atoms in the viewer (GUI) --> 2) add a new uuid to the viewer.atoms, and dispatch a atomsUpdated event; --> 3) An eventListener will trigger the update of the Python atoms; ---> 4) trigger the function to update the viewer. In this step, we will check if the new atoms and the atoms from the viewer are the same or not (by a unique uuid). In this case, the uuids will be the same, so there is no need to update the viewer.