msa.builtins.tty package

Submodules

msa.builtins.tty.events module

class msa.builtins.tty.events.StyledTextOutputEvent[source]

Bases: msa.core.event.Event

class msa.builtins.tty.events.TextInputEvent[source]

Bases: msa.core.event.Event

class msa.builtins.tty.events.TextOutputEvent[source]

Bases: msa.core.event.Event

msa.builtins.tty.handlers module

class msa.builtins.tty.handlers.TtyInputHandler(loop, event_queue, logger, config=None)[source]

Bases: msa.core.event_handler.EventHandler

Listens to stdin for terminal input and then fires a TextInputEvent.

handle()[source]

An abstract method which must be overwritten. Once the system is started, the handle method will be called repeatedly until the system shuts down. The handler must be non-blocking.

class msa.builtins.tty.handlers.TtyOutputHandler(loop: asyncio.events.AbstractEventLoop, event_queue: asyncio.queues.Queue, logger: logging.Logger, config: Optional[Dict[KT, VT]] = None)[source]

Bases: msa.core.event_handler.EventHandler

Listens to for TextOutputEvents and StyledTextOutputEvents and prints text to TTY.

handle()[source]

An abstract method which must be overwritten. Once the system is started, the handle method will be called repeatedly until the system shuts down. The handler must be non-blocking.

print(*args, **kwargs)[source]

A wrapper around print. Helps with unit tests.

msa.builtins.tty.prompt module

class msa.builtins.tty.prompt.Prompt(loop)[source]

Bases: object

An asyncio based text prompt. Listens for input from a TTY. Used by the TtyInputHandler to get input.

handle_input()[source]

Callback used by the asyncio loop reader when there is input to stdin

listen(wait=False)[source]

Listen for prompt input

msa.builtins.tty.style module

class msa.builtins.tty.style.TextAttributes[source]

Bases: object

BOLD = 'bold'
UNDERLINE = 'underline'
class msa.builtins.tty.style.TextColors[source]

Bases: object

BLUE = 'blue'
CYAN = 'cyan'
GREEN = 'green'
GREY = 'grey'
MAGENTA = 'magenta'
RED = 'red'
WHITE = 'white'
YELLOW = 'yellow'
class msa.builtins.tty.style.TextHighlights[source]

Bases: object

BLUE = 'on_blue'
CYAN = 'on_cyan'
GREEN = 'on_green'
GREY = 'on_grey'
MAGENTA = 'on_magenta'
RED = 'on_red'
WHITE = 'on_white'
YELLOW = 'on_yellow'
msa.builtins.tty.style.definition(title, description)[source]
msa.builtins.tty.style.heading(text)[source]
msa.builtins.tty.style.styled_text(text, color, attrs=None)[source]

Module contents