molfoundry.GraphPrinter#

class molfoundry.GraphPrinter#
property drawMode: DrawMode#

DrawMode.Mol (default) or DrawMode.Circles.

Type:

The depiction style

property darkMode: DarkMode#

DarkMode.Dynamic (default, follow the page), DarkMode.On (dark), or DarkMode.Off (light).

Type:

The theme

property collapseHydrogens: bool#
property withIndex: bool#

Label each drawn vertex with its id (default False), as in MØD.

A graph vertex shows its id, a rule vertex its rule node id. In a derivation’s DPO diagram the rule panels (L, K, R) show rule node ids and the graph panels (G, D, H) each vertex’s id in its own educt.

property withExternalId: bool#

Append each vertex’s external id to its label, as C:5, in every draw mode (default False).

External ids are a SMILES atom map, a GML node id, or one set with Vertex.setExternalId(). Which hydrogens are drawn is still collapseHydrogens alone, whether they have an external id or not.

property drawRuleConditions: bool#
property drawStyle: DrawStyle#

DrawStyle.Default (precise, the default) or DrawStyle.xkcd (hand-drawn: wobbly strokes + Humor-Sans glyph outlines).

Applies to graph, rule, DPO and derivation-graph rendering that uses this printer, e.g. printer.drawStyle = DrawStyle.xkcd.

Type:

The rendering style

property layout: GraphLayout#

The layout engine used when a depiction is positioned: GraphLayout.Mol (chemistry-aware, the default) or GraphLayout.Force (force-directed).

Applies to graph and rule rendering that uses this printer, e.g. printer.layout = GraphLayout.Force.

pushVertexOverlay(f)#

Push a per-vertex overlay resolver. When a graph — or a DG vertex’s molecule — is drawn, each atom’s marker is the first non-None result, trying the most recently pushed resolver first; return None for vertices you do not want to mark. Mirrors DGPrinter’s pushVertexColor / pushVertexLabel.

Example (tag carbons with an origin color and id):

printer.pushVertexOverlay(
    lambda v: VertexOverlay(color=origin_color(v), label=v.id)
    if v.stringLabel == "C" else None
)
Parameters:

f (Callable[[Vertex], Optional[VertexOverlay]])

Return type:

None

popVertexOverlay()#

Pop the most recently pushed vertex overlay resolver.

Return type:

None