All docs
Tool·
method
Tool.contribute
adds hand-built contribution objects the decorators can't express
Python
contribute(*items) -> Tool
Returns Tool — self, so calls can be chained
Parameters#
| name | type | default | description |
|---|---|---|---|
*items |
Any |
— | pre-built contribution objects (e.g. a ViewContribution) to register when the tool mounts |
Example#
Python
from lsdtools.advanced import ViewContribution
tool.contribute(ViewContribution("map3d", "3D Map", factory=build_map))
Notes#
The escape hatch for contributions the declarative API can't express — most often a custom GTK
ViewContribution. Pass a lazy factory that imports GTK only when the view is built, so
headless mounts stay safe. The items are flushed and attributed at mount.
Returns self for chaining.
See also#
Guides: The Tool object
By LSD Team · Last updated Jul 17, 2026
Ask on Discord
View as Markdown