All docs
lsdtools.views reference
Generated public SDK reference for lsdtools.views.
SDK distribution 1.0.0; API contract 1.0; generator 1.0.0.
Product source digest: 4ea39055732e8883c03ccfecf12af6ccebd2041a12ce1b843e4a769e200f5ef9.
Generated from declared public exports and source syntax. Signatures and annotations are declaration spellings; decorators, factories and annotations are never executed. Class members below are declared members; base classes remain explicit. Source docstrings describe their owning implementation; they do not grant app permissions.
``lsdtools.views`` — the data-view façade. Lazy imports (the ``generate_step`` pattern): importing
``lsdtools`` never drags a view package (or cairo/GTK) into the process; each factory imports its
package on first use and raises a clear error if it is not installed.
from lsdtools import views
v = views.table(my_table) # a TableView, fed
c = views.chart(kind="line", title="Loss")
f = views.flowchart("A\n B\n C")
print(v.to_text()); c.to_image("chart.png")
A custom data view registers its GTK drawing shell here — the one sanctioned place a package writes
GTK. In your view's ``gtk`` module (loaded via the ``lsd.view_gtk`` entry point)::
from lsdtools.views import set_view_shell
set_view_shell("my.kind", build_my_shell) # build_my_shell(view) -> a Gtk.Widget
lsdtools.views.HierarchyActionChoice#
Kind: class. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:113.
Source docstring:
One fresh exact input choice for a hierarchy View action.
Renderers must enumerate choices again at invocation and pass the exact
``values`` mapping. A first/default choice is never inferred.
Implementation alias: lsd_view_hierarchy.HierarchyActionChoice.
lsdtools.views.HierarchyActionChoice.id#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:120.
id: str
lsdtools.views.HierarchyActionChoice.label#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:121.
label: str
lsdtools.views.HierarchyActionChoice.values#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:122.
values: Mapping[str, Any]
lsdtools.views.HierarchyActionChoice.description#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:123.
description: str
description = ''
lsdtools.views.HierarchyActionChoice.values_dict#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:137.
values_dict(self) -> dict[str, Any]
self: (unannotated)
Source docstring:
Return a detached mutable copy of the exact input values.
lsdtools.views.HierarchyActionChoiceRequired#
Kind: class. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:64.
Source docstring:
Raised when an action exposes fresh choices but none was supplied.
Implementation alias: lsd_view_hierarchy.HierarchyActionChoiceRequired.
Declared bases: HierarchyActionError.
lsdtools.views.HierarchyActionChoiceUnavailable#
Kind: class. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:68.
Source docstring:
Raised when supplied values do not match one freshly enumerated choice.
Implementation alias: lsd_view_hierarchy.HierarchyActionChoiceUnavailable.
Declared bases: HierarchyActionError.
lsdtools.views.HierarchyActionError#
Kind: class. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:60.
Source docstring:
A safe, user-facing error raised by the hierarchy action-input contract.
Implementation alias: lsd_view_hierarchy.HierarchyActionError.
Declared bases: ValueError.
lsdtools.views.HierarchyView#
Kind: class. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:320.
HierarchyView(self, **config: Any) -> None
Source docstring:
A scalable keyed hierarchy with package-overridable interaction hooks.
Implementation alias: lsd_view_hierarchy.HierarchyView.
Declared bases: View.
lsdtools.views.HierarchyView.kind#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:323.
kind = 'hierarchy'
lsdtools.views.HierarchyView.search#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:325.
search = param(str, default='', label='Search', description='Case-insensitive label, description, and node-kind search.')
lsdtools.views.HierarchyView.selection#
Kind: attribute. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:331.
selection = param(str, default='single', choices=['none', 'single', 'multi'], label='Selection')
lsdtools.views.HierarchyView.__init__#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:338.
__init__(self, **config: Any) -> None
config: Any
self: (unannotated)
lsdtools.views.HierarchyView.get_action_choices#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:362.
get_action_choices(self, action_name: str) -> Sequence[HierarchyActionChoice]
action_name: str
self: (unannotated)
Source docstring:
Return fresh exact choices for *action_name*; subclasses override.
lsdtools.views.HierarchyView.invoke_action#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:394.
invoke_action(self, action_name: str, *, values: Mapping[str, Any] | None=None) -> Any
action_name: str
self: (unannotated)
values: Mapping[str, Any] | None
Source docstring:
Invoke an action with an optional freshly validated exact choice.
lsdtools.views.HierarchyView.action_input#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:435.
action_input(self, action_name: str | None=None) -> dict[str, Any] | None
action_name: str | None
self: (unannotated)
Source docstring:
Return a detached exact choice only while its action is executing.
lsdtools.views.HierarchyView.feed#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:446.
feed(self, data: Any) -> HierarchyView
data: Any
self: (unannotated)
Source docstring:
Replace the forest after validating every row, edge, cycle, and count.
Input order is the stable order for roots and siblings. Optional fields
may be omitted, but unknown fields are rejected and the exposed rows
always contain the complete canonical contract.
lsdtools.views.HierarchyView.nodes#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:541.
nodes(self) -> tuple[dict[str, Any], ...]
self: (unannotated)
Source docstring:
All canonical rows in stable forest preorder (detached copies).
lsdtools.views.HierarchyView.semantic_item_count#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:545.
semantic_item_count(self) -> int
self: (unannotated)
Source docstring:
Return the number of canonical hierarchy items, independent of UI state.
lsdtools.views.HierarchyView.semantic_items#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:549.
semantic_items(self, *, offset: int=0, limit: int=100) -> tuple[dict[str, Any], ...]
limit: int
offset: int
self: (unannotated)
Source docstring:
Return one bounded detached page of canonical items in forest preorder.
Discovery is independent of search, expansion, and selection. The
preorder is sliced before row dictionaries are materialized so a small
request never copies the complete hierarchy.
lsdtools.views.HierarchyView.node#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:574.
node(self, node_id: str) -> dict[str, Any]
node_id: str
self: (unannotated)
Source docstring:
Return one canonical detached row by exact node id.
lsdtools.views.HierarchyView.selected_ids#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:580.
selected_ids(self) -> tuple[str, ...]
self: (unannotated)
Source docstring:
Durable selection ids in user selection order, including pending restored ids.
lsdtools.views.HierarchyView.expanded_ids#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:585.
expanded_ids(self) -> tuple[str, ...]
self: (unannotated)
Source docstring:
Durable expansion ids in first-expanded order, including pending restored ids.
lsdtools.views.HierarchyView.visible_nodes#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:614.
visible_nodes(self) -> tuple[dict[str, Any], ...]
self: (unannotated)
Source docstring:
Rows currently visible under search and expansion, in stable preorder.
Search reveals each match and its ancestor path without mutating durable
expansion state. With no search, only roots and descendants of expanded
nodes are returned.
lsdtools.views.HierarchyView.expand#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:639.
expand(self, node_id: str) -> None
node_id: str
self: (unannotated)
lsdtools.views.HierarchyView.collapse#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:647.
collapse(self, node_id: str) -> None
node_id: str
self: (unannotated)
lsdtools.views.HierarchyView.toggle#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:655.
toggle(self, node_id: str) -> None
node_id: str
self: (unannotated)
lsdtools.views.HierarchyView.select#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:662.
select(self, node_ids: str | Iterable[str]) -> Any
node_ids: str | Iterable[str]
self: (unannotated)
Source docstring:
Set the keyed selection, then invoke ``on_selection_changed``.
Explicit interactive selection accepts only resident ids. Restored
state may retain pending ids until a later feed, mirroring keyed table
selection across asynchronous data delivery.
lsdtools.views.HierarchyView.clear_selection#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:687.
clear_selection(self) -> Any
self: (unannotated)
lsdtools.views.HierarchyView.activate#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:690.
activate(self, node_id: str) -> Any
node_id: str
self: (unannotated)
Source docstring:
Activate one resident node and invoke ``on_activated``.
lsdtools.views.HierarchyView.on_selection_changed#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:696.
on_selection_changed(self, selected_ids: tuple[str, ...]) -> Any
selected_ids: tuple[str, ...]
self: (unannotated)
Source docstring:
Override to project generic keyed selection into domain behavior.
lsdtools.views.HierarchyView.on_activated#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:700.
on_activated(self, node_id: str) -> Any
node_id: str
self: (unannotated)
Source docstring:
Override to handle row activation without coupling the generic view.
lsdtools.views.HierarchyView.get_state#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:704.
get_state(self) -> dict[str, Any]
self: (unannotated)
lsdtools.views.HierarchyView.apply_state#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:710.
apply_state(self, state: dict[str, Any]) -> None
self: (unannotated)
state: dict[str, Any]
lsdtools.views.HierarchyView.to_text#
Kind: method. Source: views/hierarchy/src/lsd_view_hierarchy/__init__.py:746.
to_text(self) -> str
self: (unannotated)
lsdtools.views.TableActionChoice#
Kind: class. Source: views/table/src/lsd_view_table/widget.py:77.
Source docstring:
One fresh, exact input choice for an inherited :func:`lsdtools.action`.
``id`` is stable identity for renderers, while ``values`` is the exact JSON-safe mapping that is
validated again at invocation time. Containers are recursively frozen; :meth:`values_dict`
returns a detached ordinary dictionary for a caller that needs one.
Implementation alias: lsd_view_table.widget.TableActionChoice.
lsdtools.views.TableActionChoice.id#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:85.
id: str
lsdtools.views.TableActionChoice.label#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:86.
label: str
lsdtools.views.TableActionChoice.values#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:87.
values: Mapping[str, Any]
lsdtools.views.TableActionChoice.description#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:88.
description: str
description = ''
lsdtools.views.TableActionChoice.values_dict#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:102.
values_dict(self) -> dict[str, Any]
self: (unannotated)
Source docstring:
A detached mutable copy of the exact action values.
lsdtools.views.TableActionChoiceRequired#
Kind: class. Source: views/table/src/lsd_view_table/widget.py:27.
Source docstring:
Raised when an action declares choices but no exact choice was supplied.
Implementation alias: lsd_view_table.widget.TableActionChoiceRequired.
Declared bases: TableActionError.
lsdtools.views.TableActionChoiceUnavailable#
Kind: class. Source: views/table/src/lsd_view_table/widget.py:31.
Source docstring:
Raised when supplied action values do not match a freshly enumerated choice.
Implementation alias: lsd_view_table.widget.TableActionChoiceUnavailable.
Declared bases: TableActionError.
lsdtools.views.TableActionError#
Kind: class. Source: views/table/src/lsd_view_table/widget.py:23.
Source docstring:
A safe, user-facing error raised by the table action-input contract.
Implementation alias: lsd_view_table.widget.TableActionError.
Declared bases: ValueError.
lsdtools.views.TableView#
Kind: class. Source: views/table/src/lsd_view_table/widget.py:107.
TableView(self, **config: Any) -> None
Source docstring:
Show a :class:`~lsdtools.Table` as an interactive grid. ``feed(table_or_data)`` sets the data;
the config params below choose the presentation (column subset, page size, selection mode) and the
live view state (``sort_by`` / ``sort_desc`` / ``filter``). The headless ``to_text()`` is the
aligned-ASCII preview of the composed (filtered + sorted) view.
Implementation alias: lsd_view_table.widget.TableView.
Declared bases: View.
lsdtools.views.TableView.kind#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:113.
kind = 'table'
lsdtools.views.TableView.columns#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:115.
columns = param(str, default='', label='Columns', description='Comma-separated subset to show; empty = all')
lsdtools.views.TableView.page_size#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:117.
page_size = param(int, default=20, min=1, max=10000, label='Rows per page')
lsdtools.views.TableView.selection#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:118.
selection = param(str, default='none', choices=['none', 'single', 'multi'], label='Selection')
lsdtools.views.TableView.key_columns#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:119.
key_columns = param(str, default='', label='Key columns', description='Comma-separated columns that uniquely identify a row. When set, selection survives sorting, filtering, paging, and replacement feeds.')
lsdtools.views.TableView.sort_by#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:128.
sort_by = param(str, default='', label='Sort by', description="Column to sort on; empty = the data's natural order")
lsdtools.views.TableView.sort_desc#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:130.
sort_desc = param(bool, default=False, label='Descending')
lsdtools.views.TableView.filter#
Kind: attribute. Source: views/table/src/lsd_view_table/widget.py:131.
filter = param(str, default='', label='Filter', description='Case-insensitive substring; keeps rows matching in any shown column')
lsdtools.views.TableView.__init__#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:134.
__init__(self, **config: Any) -> None
config: Any
self: (unannotated)
lsdtools.views.TableView.get_action_choices#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:144.
get_action_choices(self, action_name: str) -> Sequence[TableActionChoice]
action_name: str
self: (unannotated)
Source docstring:
Return fresh exact choices for *action_name*.
Subclasses override this for actions whose inputs depend on live project state. Returning an
empty sequence preserves ordinary zero-argument ``View.invoke`` behaviour. Choices are never
cached by the model and must not be treated as durable domain state.
lsdtools.views.TableView.invoke_action#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:171.
invoke_action(self, action_name: str, *, values: Mapping[str, Any] | None=None) -> Any
action_name: str
self: (unannotated)
values: Mapping[str, Any] | None
Source docstring:
Invoke an inherited action with an optional exact dynamic choice.
Choices are re-enumerated on every call. If one or more exist, *values* must exactly match
one fresh choice; no first/default choice is inferred. The validated detached mapping is
available only for the duration of the ordinary zero-argument action through
:meth:`action_input`, preserving the canonical :meth:`View.invoke` dispatch and event.
lsdtools.views.TableView.action_input#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:214.
action_input(self, action_name: str | None=None) -> dict[str, Any] | None
action_name: str | None
self: (unannotated)
Source docstring:
Return the validated input for the currently executing action, else ``None``.
The result is detached on every read. Supplying *action_name* guards against accidentally
consuming a nested action's input and raises when it does not name the active action.
lsdtools.views.TableView.feed#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:230.
feed(self, data: Any) -> None
data: Any
self: (unannotated)
Source docstring:
Accept a table-like value.
Positional selection is cleared. Keyed selection is retained, including keys not present
in this feed: a filter, remote page, or temporarily incomplete rerun must not silently
destroy the user's semantic selection.
lsdtools.views.TableView.key_column_names#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:265.
key_column_names(self) -> List[str]
self: (unannotated)
Source docstring:
Configured key columns in declaration order (a copy safe for callers to mutate).
lsdtools.views.TableView.view_table#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:294.
view_table(self) -> Optional[Table]
self: (unannotated)
Source docstring:
The composed view: the configured column subset, filtered by ``filter`` and ordered by
``sort_by`` / ``sort_desc`` — **all** matching rows (paging is applied separately by
:meth:`page_table`). ``None`` until fed.
lsdtools.views.TableView.semantic_item_count#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:300.
semantic_item_count(self) -> int
self: (unannotated)
Source docstring:
Number of rows addressable through the generic View semantic protocol.
lsdtools.views.TableView.semantic_items#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:305.
semantic_items(self, *, offset: int=0, limit: int=100) -> tuple[dict[str, Any], ...]
limit: int
offset: int
self: (unannotated)
Source docstring:
Return one composed row page using stable configured keys when available.
This is the sole control-plane projection for table rows. Hidden key columns remain
usable as identity without being added back to the presented row data.
lsdtools.views.TableView.page_table#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:366.
page_table(self) -> Optional[Table]
self: (unannotated)
Source docstring:
The current page of the composed view (``page_size`` rows starting at ``_page``).
lsdtools.views.TableView.row_count#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:374.
row_count(self) -> int
self: (unannotated)
Source docstring:
Rows in the composed (filtered) view — not the raw fed table.
lsdtools.views.TableView.total_count#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:379.
total_count(self) -> int
self: (unannotated)
Source docstring:
Rows across every page; cursor-backed subclasses may override.
lsdtools.views.TableView.page_count#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:383.
page_count(self) -> int
self: (unannotated)
lsdtools.views.TableView.set_page#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:386.
set_page(self, page: int) -> None
page: int
self: (unannotated)
Source docstring:
Select and clamp a zero-based page.
Cursor-backed subclasses override this to fetch their remote page.
lsdtools.views.TableView.selected_rows#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:460.
selected_rows(self) -> List[int]
self: (unannotated)
Source docstring:
Selected positions in the current composed/resident table.
With ``key_columns``, :attr:`selected_keys` is authoritative and these positions are
recomputed whenever presentation order changes.
lsdtools.views.TableView.selected_keys#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:477.
selected_keys(self) -> List[List[Any]]
self: (unannotated)
Source docstring:
The authoritative semantic selection as ordered JSON-safe compound keys.
lsdtools.views.TableView.selected_page_rows#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:482.
selected_page_rows(self) -> List[int]
self: (unannotated)
Source docstring:
Zero-based positions selected on the current page, for any presentation shell.
lsdtools.views.TableView.select_keys#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:494.
select_keys(self, keys: Any) -> None
keys: Any
self: (unannotated)
Source docstring:
Set semantic selection directly.
Keys are ordered lists whose width matches ``key_columns``. Values must be JSON scalars;
unresolved keys are retained so remote paging and transient reruns cannot erase intent.
lsdtools.views.TableView.select_rows#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:521.
select_rows(self, rows: Any) -> None
rows: Any
self: (unannotated)
Source docstring:
Set selection by composed-view row positions.
With ``key_columns`` the positions are immediately resolved to semantic keys. Otherwise this
retains the original positional behaviour. Emits ``selection-changed``.
lsdtools.views.TableView.select_page_rows#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:538.
select_page_rows(self, rows: Any) -> None
rows: Any
self: (unannotated)
Source docstring:
Apply a UI gesture expressed as positions within the current page.
In keyed multi-select mode, selections on unloaded pages are retained. Positional mode keeps
its historical page-relative-to-global conversion.
lsdtools.views.TableView.get_selection#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:558.
get_selection(self) -> Optional[Table]
self: (unannotated)
Source docstring:
Selected resident rows as a sub-table in current view order.
A remote keyed view can retain keys from unloaded pages; only selected rows in the resident
page are returned here.
lsdtools.views.TableView.set_column_renderer#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:582.
set_column_renderer(self, column: str, renderer: Optional[str]) -> None
column: str
renderer: Optional[str]
self: (unannotated)
Source docstring:
Render *column*'s cells through the registered cell renderer named *renderer* (see
:func:`lsd_view_table.register_cell_renderer`) instead of the default label. ``renderer=None``
(or ``""``) clears it. Headless config: it's stored as data here and applied by the GTK shell;
an unknown name simply falls back to the label. Emits ``data-changed`` so a live grid rebuilds.
lsdtools.views.TableView.column_renderers#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:594.
column_renderers(self) -> Dict[str, str]
self: (unannotated)
Source docstring:
The ``{column: renderer_name}`` map the GTK shell passes to ``ColumnGrid.set_columns``.
lsdtools.views.TableView.to_text#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:599.
to_text(self) -> str
self: (unannotated)
lsdtools.views.TableView.to_csv#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:607.
to_csv(self) -> str
self: (unannotated)
Source docstring:
The composed (filtered + sorted) view as CSV text — the copy / export payload.
lsdtools.views.TableView.get_state#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:620.
get_state(self) -> dict
self: (unannotated)
lsdtools.views.TableView.apply_state#
Kind: method. Source: views/table/src/lsd_view_table/widget.py:630.
apply_state(self, state: dict) -> None
self: (unannotated)
state: dict
lsdtools.views.View#
Kind: class. Source: core/lsd/src/lsd/core/view.py:449.
View(self, *, name: str='', icon: Optional[str]=None, **config: Any) -> None
Source docstring:
A presentable surface: ``param()`` fields + ``@action`` operations + optional data.
Subclass it for a **panel** (params + actions). Set a ``kind`` and override ``feed`` /
``to_text`` / ``to_image`` for a **data view** (table / chart / flowchart / custom).
Implementation alias: lsd.core.view.View.
Declared bases: Configurable.
lsdtools.views.View.kind#
Kind: attribute. Source: core/lsd/src/lsd/core/view.py:455.
kind: ClassVar[str]
kind = ''
lsdtools.views.View.ctx#
Kind: attribute. Source: core/lsd/src/lsd/core/view.py:461.
ctx: ClassVar[Any]
ctx = None
lsdtools.views.View.title#
Kind: attribute. Source: core/lsd/src/lsd/core/view.py:463.
title = param(str, default='', label='Title')
lsdtools.views.View.location#
Kind: attribute. Source: core/lsd/src/lsd/core/view.py:464.
location = param(str, default='editor', choices=['editor', 'sidebar'], label='Location', visibility='hidden')
lsdtools.views.View.__init__#
Kind: method. Source: core/lsd/src/lsd/core/view.py:485.
__init__(self, *, name: str='', icon: Optional[str]=None, **config: Any) -> None
config: Any
icon: Optional[str]
name: str
self: (unannotated)
lsdtools.views.View.engine#
Kind: method. Source: core/lsd/src/lsd/core/view.py:506.
engine(self) -> Any
self: (unannotated)
Source docstring:
The :class:`~lsd.runtime.engine.Engine` this view is attached to (``engine.add(view)``),
or ``None`` — the symmetry partner of :attr:`Entity.engine`.
lsdtools.views.View.watch#
Kind: method. Source: core/lsd/src/lsd/core/view.py:512.
watch(self, *targets: Any) -> 'View'
self: (unannotated)
targets: Any
Source docstring:
Hold the output of each :class:`~lsd.tree.entity.Entity` in *targets*, and refresh on re-run.
Each target is an ``Entity``, a stable entity id, or an unambiguous display name (sugar).
Returns ``self``, so
``views.table().watch(assays)`` reads as one phrase. **Any order works**:
* *add-then-watch*, *watch-then-add* (view or entity first) — all equivalent;
* a missing string reference is kept **pending** and resolves when that entity is added;
* **auto-pull** — watching an entity that has *already* run delivers its output immediately,
which is what makes drag-and-drop and reopened projects feel instant.
Watches are stored by entity **id**, so they survive a rename and a project reload; removal
from the Workspace auto-unwatches them. Delivery goes through :meth:`on_output` (default:
``feed(output)``) on ``engine/entity/finished`` with ``ok=True``.
lsdtools.views.View.watch_output#
Kind: method. Source: core/lsd/src/lsd/core/view.py:551.
watch_output(self, *references: OutputRef) -> 'View'
references: OutputRef
self: (unannotated)
Source docstring:
Watch exact named step outputs and refresh them after successful runs.
Each reference contains only stable ``entity_id`` + ``step_id`` +
declared ``output_port`` coordinates. A structurally valid reference
may be registered before its entity is attached; once the entity is
present, a missing step or undeclared port is rejected and never falls
back to :attr:`Entity.output`.
lsdtools.views.View.unwatch_output#
Kind: method. Source: core/lsd/src/lsd/core/view.py:629.
unwatch_output(self, *references: OutputRef) -> 'View'
references: OutputRef
self: (unannotated)
Source docstring:
Stop watching exact output references; unknown references are ignored.
lsdtools.views.View.unwatch#
Kind: method. Source: core/lsd/src/lsd/core/view.py:637.
unwatch(self, *targets: Any) -> 'View'
self: (unannotated)
targets: Any
Source docstring:
Stop watching each entity (or entity name) in *targets*. Unknown targets are ignored.
Already-delivered data stays — unwatching breaks the link, it does not clear the view.
lsdtools.views.View.watched#
Kind: method. Source: core/lsd/src/lsd/core/view.py:660.
watched(self) -> List[str]
self: (unannotated)
Source docstring:
The names of the entities this view watches — live (a renamed entity reports its new name),
plus any names still pending an entity. Watch order is preserved.
lsdtools.views.View.watched_outputs#
Kind: method. Source: core/lsd/src/lsd/core/view.py:671.
watched_outputs(self) -> List[OutputRef]
self: (unannotated)
Source docstring:
Exact output references in watch order (a detached copy).
lsdtools.views.View.on_output#
Kind: method. Source: core/lsd/src/lsd/core/view.py:675.
on_output(self, entity: Any, output: Any) -> None
entity: Any
output: Any
self: (unannotated)
Source docstring:
Called with a watched *entity*'s fresh output. The default hands it to :meth:`feed`.
Override for a view that watches several entities at once (e.g. a 3-D viewer keying layers by
``entity.id``), where last-write-wins ``feed`` is not what you want.
lsdtools.views.View.on_output_ref#
Kind: method. Source: core/lsd/src/lsd/core/view.py:682.
on_output_ref(self, entity: Any, reference: OutputRef, output: Any) -> None
entity: Any
output: Any
reference: OutputRef
self: (unannotated)
Source docstring:
Receive one exact named output; defaults to :meth:`on_output`.
Multi-output views may override this method to retain ``reference`` as
the semantic key while legacy views continue to override ``on_output``.
lsdtools.views.View.get_actions#
Kind: method. Source: core/lsd/src/lsd/core/view.py:988.
get_actions(self) -> List[ActionInfo]
self: (unannotated)
Source docstring:
Snapshot of all actions, in declaration order — for a renderer / CLI to build controls.
lsdtools.views.View.set_action_input_initial#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1013.
set_action_input_initial(self, name: str, value: Mapping[str, Any] | None) -> None
name: str
self: (unannotated)
value: Mapping[str, Any] | None
Source docstring:
Replace one complete action-form snapshot, or make that form unavailable.
This is runtime presentation state, never persisted View configuration. A caller must
supply every declared field, including hidden versions and optimistic fences. Removing a
snapshot disables the form; it never turns an input action into a zero-input command.
lsdtools.views.View.set_action_input_initials#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1037.
set_action_input_initials(self, values: Mapping[str, Mapping[str, Any]]) -> None
self: (unannotated)
values: Mapping[str, Mapping[str, Any]]
Source docstring:
Atomically replace every currently available typed-action form snapshot.
lsdtools.views.View.invoke#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1064.
invoke(self, name: str, *, input: Any=_NO_ACTION_INPUT) -> Any
input: Any
name: str
self: (unannotated)
Source docstring:
Run an action by name and return its result. The single dispatch entry for every
front-end. Emits ``view/action/invoked``. Unknown name → ``AttributeError``; a disabled
action is a logged no-op.
lsdtools.views.View.feed#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1096.
feed(self, data: Any) -> 'View'
data: Any
self: (unannotated)
Source docstring:
Give the view its data (a Table, a payload dict, a graph…). Data views store it and call
:meth:`_data_changed`; a params-and-actions panel has no data, so the base raises.
lsdtools.views.View.on_view_event#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1119.
on_view_event(self, event: str, cb: Callable[..., None]) -> None
cb: Callable[..., None]
event: str
self: (unannotated)
lsdtools.views.View.off_view_event#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1122.
off_view_event(self, event: str, cb: Callable[..., None]) -> None
cb: Callable[..., None]
event: str
self: (unannotated)
lsdtools.views.View.emit_view_event#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1127.
emit_view_event(self, event: str, **data: Any) -> None
data: Any
event: str
self: (unannotated)
lsdtools.views.View.to_text#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1135.
to_text(self) -> str
self: (unannotated)
Source docstring:
A plain-text rendering (agents / CLI / logs). Data views override; the base (a panel) is a
params + actions summary.
lsdtools.views.View.to_image#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1148.
to_image(self, path: Optional[str]=None, *, width: int=1024, height: int=768) -> 'bytes | str'
height: int
path: Optional[str]
self: (unannotated)
width: int
Source docstring:
Render to a PNG — returns the bytes, or writes to *path* and returns it. Data views that
can draw override this (lazily importing cairo); the base signals it is unsupported.
lsdtools.views.View.get_state#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1155.
get_state(self) -> dict
self: (unannotated)
Source docstring:
A JSON-able snapshot: the config param values plus the ``watch`` links (data views extend
with data/selection). ``watch`` is ``{"ids": {entity id: name}, "pending": [name]}`` — ids,
so a restored view re-links to the same entities across a rename and a project reload.
lsdtools.views.View.apply_state#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1174.
apply_state(self, state: dict) -> None
self: (unannotated)
state: dict
lsdtools.views.View.show#
Kind: method. Source: core/lsd/src/lsd/core/view.py:1271.
show(self, mode: str='auto') -> Any
mode: str
self: (unannotated)
Source docstring:
Present the view. ``mode``: ``"window"`` opens a front-end window (needs a presenter),
``"text"`` prints the console rendering, ``"auto"`` (default) is a window if a presenter is
registered (a front-end is loaded), else text.
lsdtools.views.available#
Kind: function. Source: sdk/src/lsdtools/views.py:191.
available() -> list[str]
Source docstring:
Installed data-view kinds, discovered without importing their packages.
lsdtools.views.cadquery_studio#
Kind: function. Source: sdk/src/lsdtools/views.py:170.
cadquery_studio(*, recipe: Any, view_id: str | None=None)
recipe: Any
view_id: str | None
Source docstring:
Build the native code-left / 3-D-right CadQuery Studio presentation.
``recipe`` must be immutable package-owned source with bounded typed
parameters. This factory intentionally exposes no source-string executor:
arbitrary project Python remains behind Desktop's explicit code-consent
workflow.
lsdtools.views.chart#
Kind: function. Source: sdk/src/lsdtools/views.py:130.
chart(data: Any=None, *, kind: str='line', **config: Any)
config: Any
data: Any
kind: str
Source docstring:
A :class:`ChartView` (from ``lsd-view-chart``) of *kind*, fed *data* if given.
lsdtools.views.dashboard#
Kind: function. Source: sdk/src/lsdtools/views.py:142.
dashboard(data: Any=None, *, document: Any=None, **config: Any)
config: Any
data: Any
document: Any
Source docstring:
A :class:`DashboardView` (from ``lsd-view-dashboard``), optionally fed *data*.
``document`` is a versioned report definition; source tables remain transient and are never
embedded into its persisted state.
lsdtools.views.flowchart#
Kind: function. Source: sdk/src/lsdtools/views.py:158.
flowchart(source: Any=None, **config: Any)
config: Any
source: Any
Source docstring:
A :class:`FlowchartView` (from ``lsd-view-flowchart``), fed *source* (DSL/Graph) if given.
lsdtools.views.hierarchy#
Kind: function. Source: sdk/src/lsdtools/views.py:118.
hierarchy(data: Any=None, **config: Any)
config: Any
data: Any
Source docstring:
A generic keyed :class:`HierarchyView`, fed *data* when supplied.
lsdtools.views.set_view_shell#
Kind: function. Source: core/lsd/src/lsd/core/view.py:1441.
set_view_shell(kind: str, factory: Callable[..., Any]) -> None
factory: Callable[..., Any]
kind: str
Source docstring:
Register the callable that turns a data view of *kind* into a front-end control (a GTK widget).
Called by a view package's ``gtk`` module — the only sanctioned place to write GTK.
Implementation alias: lsd.core.view.set_view_shell.
lsdtools.views.table#
Kind: function. Source: sdk/src/lsdtools/views.py:106.
table(data: Any=None, **config: Any)
config: Any
data: Any
Source docstring:
A :class:`TableView` (from ``lsd-view-table``), fed *data* if given.
lsdtools.views.view_shell#
Kind: function. Source: core/lsd/src/lsd/core/view.py:1485.
view_shell(view: 'View', **kwargs: Any) -> Any
kwargs: Any
view: 'View'
Source docstring:
Build the front-end control for a data *view* via its registered shell, or raise a clear error.
Implementation alias: lsd.core.view.view_shell.
lsdtools.views.view_type#
Kind: function. Source: core/lsd/src/lsd/core/view.py:1336.
view_type(kind: str) -> Optional[type]
kind: str
Implementation alias: lsd.core.view.view_type.