kempnerpulse.present.controller

Keyboard command handling and the raw-terminal context manager.

CommandController owns the view state the dashboard reads (focused GPU, plot/job mode, fleet scroll offset, the :-command buffer) and parses raw stdin bytes — including CSI arrow/page escape sequences — into state changes. cbreak_stdin() puts the terminal into cbreak mode so single keystrokes are delivered without a newline; outside a TTY it is a no-op.

Functions

cbreak_stdin(enabled)

Put stdin into cbreak mode for single-keystroke input; no-op off-TTY.

Classes

CommandController

View-mode and input state shared between the input loop and the renderer.

class kempnerpulse.present.controller.CommandController[source]

Bases: object

View-mode and input state shared between the input loop and the renderer.

__init__(initial_focus=None)[source]
Parameters:

initial_focus (str | None)

hint()[source]
Return type:

str

scroll_fleet(delta)[source]

Adjust the fleet scroll offset; the renderer clamps the upper bound.

Parameters:

delta (int)

Return type:

None

handle_input(available_gpu_ids)[source]

Drain any pending stdin and apply it; a no-op without a TTY.

Parameters:

available_gpu_ids (Set[str])

Return type:

None

kempnerpulse.present.controller.cbreak_stdin(enabled)[source]

Put stdin into cbreak mode for single-keystroke input; no-op off-TTY.

Parameters:

enabled (bool)