cbouy / mols2grid

Interactive molecule viewer for 2D structures

Home Page:https://mols2grid.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different MolGrid instances "share" .get_selection

bieniekmateusz opened this issue · comments

Hello. We added one more MolGrid instance and it appears that the first MolGrid selection affects what is selected in the second MolGrid.

import mols2grid

m1 = mols2grid.MolGrid()
m2 = mols2grid.MolGrid()

# select the first item on m1

m2.get_selection()
# shows the item selected with the index of m1

Version: mols2grid-0.2.2

I am bit busy now but I'll try to have a look in the near future.

Hi @bieniekmateusz,

When you create the grids, you need to give them different names:

m1 = mols2grid.MolGrid(name="m1")
m2 = mols2grid.MolGrid(name="m2")

This way the selections shouldn't overlap

Thanks @cbouy , sadly that doesn't seem to have resolved my issue. I'll create a minimum example and share it here shortly.

Thanks again, here is the smallest notebook with the bug:
name2molsgrids.zip

Great, thanks! I found where the bug comes from, the bugfix is now available on the master branch.
I'll try to release a new version next week with this change