INNER CODE UNIT · Python
on_node_selected
idoavrah/terraform-tui · src/tftui/app.py:313
def on_node_selected(self, event: Tree.NodeSelected[NodeData]) -> None:
resource = event.node.data
if not isinstance(resource, Resource):
return
secrets = self.state_tree.loaded.secrets_for(resource.full_address)
if self._search_target == RESOURCE:
self._clear_search()
self.resource_view.show(resource, secrets=secrets)
self._show(RESOURCE, resource.full_address)
@on(StateTree.SelectionChanged)
def on_selection_changed(self, event: StateTree.SelectionChanged) -> None:
"""Show the selection count on the pane border.
There is no Textual `Header` in this layout, so `sub_title` only ever
reaches the terminal's own title bar. Selecting a whole module can pick
up dozens of resources, most of them scrolled out of sight, so the count
needs somewhere on screen to live.