improv.tui#

Module Contents#

Classes#

SocketLog

A widget for logging text.

QuitScreen

A widget for the root of the app.

HelpScreen

A widget for the root of the app.

TUI

View class for the text user interface. Implemented as a Textual app.

Attributes#

logger

CONTROL_PORT

improv.tui.logger#
class improv.tui.SocketLog(port, context, *args, **kwargs)[source]#

Bases: textual.widgets.TextLog

A widget for logging text.

class Echo(sender, value)[source]#

Bases: textual.message.Message

Base class for a message.

write(content, width=None, expand=False, shrink=True)[source]#

Write text or a rich renderable.

Parameters:
  • content – Rich renderable (or text).

  • width – Width to render or None to use optimal width.

  • expand – Enable expand to widget width, or False to use width.

  • shrink – Enable shrinking of content to fit width.

async poll()[source]#
async on_mount() None[source]#

Event handler called when widget is added to the app.

class improv.tui.QuitScreen(name: str | None = None, id: str | None = None, classes: str | None = None)[source]#

Bases: textual.screen.Screen

A widget for the root of the app.

compose() textual.app.ComposeResult[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

async on_key(event) None[source]#
on_button_pressed(event: textual.widgets.Button.Pressed) None[source]#
class improv.tui.HelpScreen(name: str | None = None, id: str | None = None, classes: str | None = None)[source]#

Bases: textual.screen.Screen

A widget for the root of the app.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

on_button_pressed(event: textual.widgets.Button.Pressed) None[source]#
class improv.tui.TUI(control_port, output_port, logging_port)[source]#

Bases: textual.app.App

View class for the text user interface. Implemented as a Textual app.

CSS_PATH = 'tui.css'#
BINDINGS = [('tab', 'focus_next', 'Focus Next'), ('ctrl+c', 'request_quit', 'Emergency Quit'), ('ctrl+p',...#
action_set_debug()[source]#
static format_log_messages(parts)[source]#
compose() textual.app.ComposeResult[source]#

Create child widgets for the app.

async send_to_controller(msg)[source]#

Safe version of send/receive with controller. Based on the Lazy Pirate pattern [here] (https://zguide.zeromq.org/docs/chapter4/#Client-Side-Reliability-Lazy-Pirate-Pattern)

async on_mount()[source]#
async on_input_submitted(message)[source]#
async on_socket_log_echo(message)[source]#
action_request_quit()[source]#
action_help()[source]#
improv.tui.CONTROL_PORT = '5555'#