MCPcopy
hub / github.com/Textualize/textual / _on_mount

Method _on_mount

src/textual/command.py:818–833  ·  view source on GitHub ↗

Configure the command palette once the DOM is ready.

(self, _: Mount)

Source from the content-addressed store, hash-verified

816 self.dismiss()
817
818 def _on_mount(self, _: Mount) -> None:
819 """Configure the command palette once the DOM is ready."""
820
821 self.app.post_message(CommandPalette.Opened())
822 self._calling_screen = self.app.screen_stack[-2]
823
824 match_style = self.get_visual_style("command-palette--highlight", partial=True)
825
826 assert self._calling_screen is not None
827 self._providers = [
828 provider_class(self._calling_screen, match_style)
829 for provider_class in self._provider_classes
830 ]
831 for provider in self._providers:
832 provider._post_init()
833 self._gather_commands("")
834
835 async def _on_unmount(self) -> None: # type: ignore[override]
836 """Shutdown providers when command palette is closed."""

Callers

nothing calls this directly

Calls 4

_gather_commandsMethod · 0.95
get_visual_styleMethod · 0.80
_post_initMethod · 0.80
post_messageMethod · 0.45

Tested by

no test coverage detected