Skip to content

Improve MoleculeWidget API documentation in README#8

Merged
dkratzert merged 1 commit intomainfrom
copilot/improve-documentation-moleculewidget-again
Apr 12, 2026
Merged

Improve MoleculeWidget API documentation in README#8
dkratzert merged 1 commit intomainfrom
copilot/improve-documentation-moleculewidget-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

The MoleculeWidget section of the README only listed method names in a single line with no parameter details, signal documentation, or usage guidance.

Changes

  • Qt Signals — added a table documenting atomClicked(label: str) and bondClicked(label1: str, label2: str) with descriptions of when each fires
  • Data methods — fully documented open_molecule(), grow_molecule(), and clear() including all parameter types (Atomtuple structure, cell tuple format, ADP dict layout, keep_view semantics)
  • Display/view methods — individually documented show_adps, show_labels, show_hydrogens, show_round_bonds, set_bond_width (with valid range), setLabelFont, set_background_color, and reset_view
  • Direct-data example — added a code snippet showing construction of Atomtuple objects, ADP dict, and signal connection without going through MoleculeLoader
  • Typo fix — corrected "froma""from a" in the screenshot caption
from fastmolwidget import MoleculeWidget
from fastmolwidget.sdm import Atomtuple

mol = MoleculeWidget(parent=self)
atoms = [
    Atomtuple(label="C1", type="C", x=0.0,  y=0.0,  z=0.0,  part=0),
    Atomtuple(label="O1", type="O", x=1.22, y=0.0,  z=0.0,  part=0),
]
adps = {"C1": (0.02, 0.02, 0.02, 0.0, 0.0, 0.0)}
mol.open_molecule(atoms=atoms, cell=(5.0, 5.0, 5.0, 90.0, 90.0, 90.0), adps=adps)
mol.atomClicked.connect(lambda label: print(f"Selected: {label}"))

Agent-Logs-Url: https://github.com/dkratzert/Fastmolwidget/sessions/3a7a33aa-7bd9-4f45-9615-45cb5003b7cc

Co-authored-by: dkratzert <3948149+dkratzert@users.noreply.github.com>
@dkratzert dkratzert marked this pull request as ready for review April 12, 2026 19:57
@dkratzert dkratzert merged commit 61f0f0f into main Apr 12, 2026
@dkratzert dkratzert deleted the copilot/improve-documentation-moleculewidget-again branch April 13, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants