Source code for cadrumo.entrypoints.tui.components.host
"""A minimal application that carries one screen for a standalone run.An area's entry surface is a screen so a root shell can navigate to it.Some callers still open one surface as a whole process -- the developmentharness, and the line-mode entry points that hand control to a singlefull-screen task -- and this host is what those use. It holds no behaviourof its own beyond mounting the screen and reporting its dismissal as theprocess result, so a surface behaves identically whether it is navigated toor opened alone."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfromtextual.appimportAppfrom.themeimportBASE_CSS,install_cadrumo_themes,tokenisedifTYPE_CHECKING:fromtextual.screenimportScreen
[docs]classScreenHostApp[ResultT](App[ResultT|None]):"""Run exactly one screen as its own process."""CSS=tokenised(BASE_CSS)def__init__(self,screen:Screen[ResultT|None])->None:"""Bind the one screen this host exists to run."""super().__init__()self._hosted_screen=screen@propertydefhosted_screen(self)->Screen[ResultT|None]:"""The screen under this host, for a caller that addresses it directly."""returnself._hosted_screen
[docs]asyncdefon_mount(self)->None:"""Mount the screen and exit when it dismisses. Awaited rather than fired and forgotten: a caller that starts this host and immediately addresses a control would otherwise race the push and find only the host's own empty default screen. """install_cadrumo_themes(self)awaitself.push_screen(self._hosted_screen,self.exit)