Module userland.scripts.main
Main menu script
Functions
async def main(cx: SSHContext) ‑> None
Classes
class MenuApp (context: SSHContext, **kwargs)
-
Main menu
Create an instance of an app.
Args
driver_class
- Driver class or
None
to auto-detect. This will be used by some Textual tools. css_path
- Path to CSS or
None
to use theCSS_PATH
class variable. To load multiple CSS files, pass a list of strings or paths which will be loaded in order. watch_css
- Reload CSS if the files changed. This is set automatically if
you are using
textual run
with thedev
switch.
Raises
CssPathError
- When the supplied CSS path(s) are an unexpected type.
Expand source code
class MenuApp(XthuluApp): """Main menu""" CSS = """ Button { margin-bottom: 1; max-width: 100%; width: 20; } VerticalScroll { height: auto; width: 20; } """ """Stylesheet""" def compose(self) -> ComposeResult: yield Center( Middle( VerticalScroll( Button("Messages", name="messages"), Button("Node chat", name="chat"), Button("Oneliners", name="oneliners"), Button("Lock example", name="lock_example"), Button("Log off", name="goto_logoff", variant="error"), ) ) ) async def on_button_pressed(self, event: Button.Pressed) -> None: assert event.button.name return self.exit(result=event.button.name)
Ancestors
- XthuluApp
- textual.app.App
- typing.Generic
- textual.dom.DOMNode
- textual.message_pump.MessagePump
Class variables
var CSS
-
Stylesheet
Methods
def compose(self) ‑> Iterable[textual.widget.Widget]
-
Yield child widgets for a container.
This method should be implemented in a subclass.
Inherited members