schrodinger.ui.qt.rdmol_views module

class schrodinger.ui.qt.rdmol_views.RDMolStructureItem(parent: Optional[PyQt6.QtWidgets.QGraphicsItem] = None)

Bases: PyQt6.QtWidgets.QGraphicsItem

Graphics item that displays a 2D structure image using a RdMolDelegate.

__init__(parent: Optional[PyQt6.QtWidgets.QGraphicsItem] = None)
getRDMol() Optional[rdkit.Chem.rdchem.Mol]
Returns

the ligand structure currently stored on this object

setRDMol(rdmol: Optional[rdkit.Chem.rdchem.Mol])

Assign a new ligand structure.

Parameters
  • rdmol – optionally, a Mol instance to render into a 2D image; if None, this widget will not render an image

  • update – whether to update the displayed image

getAtomHighlights() Tuple[Optional[Tuple[int]], Optional[Tuple[int]]]
Returns

a tuple containing the highlighted atom indices and highlight color (in RGB form) currently stored on this object

setAtomHighlights(atom_idcs: Optional[Tuple[int]], color: Optional[Tuple[int]])

Assign the highlighted atoms and highlighting color for the image.

Parameters
  • atom_idcs – indices of the atoms to be highlighted

  • color – color (in RGB form) to use for drawing highlighted atoms

  • update – whether to update the displayed image

setImageDelegate(delegate: schrodinger.ui.qt.delegates.RdMolDelegate)

Assign a delegate that can be used to provide 2D structure images.

Parameters
  • delegate – optionally, a delegate instance. If None, this widget will not render an image

  • update – whether to update the displayed image

boundingRect() PyQt6.QtCore.QRectF
Returns

the area into which the structure image is rendered

setBoundingRect(rect: PyQt6.QtCore.QRectF)
Parameters

rect – set the area into which the structure image is rendered

paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: Optional[QWidget] = None)
class schrodinger.ui.qt.rdmol_views.AbstractRDMolImageLabel(parent: Optional[PyQt6.QtWidgets.QWidget] = None)

Bases: PyQt6.QtWidgets.QLabel

Abstract widget that draws 2D molecule images within the content rectangle using RdMolDelegate.

In order to show any image, an instance must be assigned a RdMolDelegate instance (using setImageDelegate()) and a Mol instance (using setRDMol()). Modifications such as parameters for atom coloring and labeling are supported but not required.

__init__(parent: Optional[PyQt6.QtWidgets.QWidget] = None)
paintEvent(self, a0: QPaintEvent)
setImageDelegate(delegate: Optional[schrodinger.ui.qt.delegates.RdMolDelegate], update: bool = True)

Assign a delegate that can be used to provide 2D structure images.

Parameters
  • delegate – optionally, a delegate instance. If None, this widget will not render an image

  • update – whether to update the displayed image

setRDMol(rdmol: Optional[rdkit.Chem.rdchem.Mol], update: bool = True)

Assign a new ligand structure.

Parameters
  • rdmol – optionally, a Mol instance to render into a 2D image; if None, this widget will not render an image

  • update – whether to update the displayed image

setAtomHighlights(atom_idcs: Optional[Tuple[int]], color: Optional[Tuple[int]], update: bool = True)

Assign the highlighted atoms and highlighting color for the image.

Parameters
  • atom_idcs – indices of the atoms to be highlighted

  • color – color (in RGB form) to use for drawing highlighted atoms

  • update – whether to update the displayed image

setAtomLabels(atom_labels: Optional[Tuple[str]], update: bool = True)

Assign the atom labels for the image.

Parameters
  • atom_labels – a tuple of labels ordered so that the index of each atom matches the index of the corresponding label

  • update – whether to update the displayed image

clearModifications(update: bool = True)

Clear any stored image modification parameters.

Parameters

update – whether to update the displayed image

class schrodinger.ui.qt.rdmol_views.ResizableRDMolImageLabel(parent: Optional[PyQt6.QtWidgets.QWidget] = None)

Bases: schrodinger.ui.qt.rdmol_views.AbstractRDMolImageLabel

Widget showing a 2D structure image that can be resized at will by the user.

resizeEvent(self, a0: QResizeEvent)
class schrodinger.ui.qt.rdmol_views.FixedSizeRDMolImageLabel(parent: Optional[PyQt6.QtWidgets.QWidget] = None)

Bases: schrodinger.ui.qt.rdmol_views.AbstractRDMolImageLabel

Widget showing a 2D structure image that can be assigned a fixed size.

setImageSize(width: int, height: int, update: bool = True)
class schrodinger.ui.qt.rdmol_views.RDMolTooltipWithLabel(parent: Optional[PyQt6.QtWidgets.QWidget] = None)

Bases: schrodinger.ui.qt.tooltips.TooltipMixin, PyQt6.QtWidgets.QFrame

A tooltip widget that renders a 2D image of a specified ligand structure.

It can also show any number of additional text labels at the bottom.

__init__(parent: Optional[PyQt6.QtWidgets.QWidget] = None)
Parameters

offset (tuple[int, int] or NoneType) – offset coordinates (in pixels) from the mouse pointer position to draw the upper left corner of the tooltip window. If not supplied, will default to DEFAULT_OFFSET.

setImageSize(width: int, height: int, update: bool = True)

Assign the size of the image.

setRDMol(rdmol: Optional[rdkit.Chem.rdchem.Mol], update: bool = True)

Assign a new ligand structure.

Parameters
  • rdmol – optionally, a Mol instance to render into a 2D image; if None, this widget will not render an image

  • update – whether to update the displayed image

setImageDelegate(delegate: schrodinger.ui.qt.delegates.RdMolDelegate, update: bool = True)

Assign a delegate that can be used to provide 2D structure images.

Parameters
  • delegate – optionally, a delegate instance. If None, this widget will not render an image

  • update – whether to update the displayed image

addLabel(text: str)

Add a label containing the specified text underneath the structure picture.

Parameters

text – text to include below the image