runtimepy.tui package
runtimepy.tui.cursor module
A basic cursor implementation for TUIs.
- 
class runtimepy.tui.cursor.Cursor(window: Any)[source]
- Bases: - object
 - A simple cursor implementation. - 
- 
property height: int
- Get the height of this cursor’s window. 
 - 
- 
inc_x(amount: int = 1) → bool[source]
- Increment the cursor’s X coordinate. 
 - 
- 
inc_y(amount: int = 1) → bool[source]
- Increment the cursor’s Y coordinate. 
 - 
- 
move(new_y: int = None, new_x: int = None) → bool[source]
- Perform the underlying cursor move. 
 - 
- 
poll_max() → bool[source]
- Update the min and max cursor positions. 
 - 
- 
reset() → None[source]
- Reset this cursor. 
 - 
- 
property width: int
- Get the width of this cursor’s window. 
 
runtimepy.tui.mixin module
A module for terminal user-interface application mixins.
- 
runtimepy.tui.mixin.CursesWindow
- alias of - Any
 
- 
class runtimepy.tui.mixin.Cursor(window: Any)[source]
- Bases: - object
 - A simple cursor implementation. - 
- 
property height: int
- Get the height of this cursor’s window. 
 - 
- 
inc_x(amount: int = 1) → bool[source]
- Increment the cursor’s X coordinate. 
 - 
- 
inc_y(amount: int = 1) → bool[source]
- Increment the cursor’s Y coordinate. 
 - 
- 
move(new_y: int = None, new_x: int = None) → bool[source]
- Perform the underlying cursor move. 
 - 
- 
poll_max() → bool[source]
- Update the min and max cursor positions. 
 - 
- 
reset() → None[source]
- Reset this cursor. 
 - 
- 
property width: int
- Get the width of this cursor’s window. 
 
- 
class runtimepy.tui.mixin.TuiMixin(window: Any | None = None)[source]
- Bases: - object
 - A class mixin for building TUI applications. - 
- 
cursor: Cursor
 - 
- 
async handle_char(char: int) → bool[source]
- Handle character input. 
 - 
- 
init(window: Any | None) → bool[source]
- Initialize this interface’s window. 
 - 
- 
tui_update() → None[source]
- Re-draw the screen. 
 - 
- 
update_dimensions() → Any[source]
- Handle an update to the window’s dimensions. 
 - 
- 
property window: Any
- Get the window for this instance. 
 
runtimepy.tui.mock module
A module implementing a simple window mock.
- 
class runtimepy.tui.mock.WindowMock(width: int = 64, height: int = 64)[source]
- Bases: - object
 - A simple window mock. - 
- 
getmaxyx() → Tuple[int, int][source]
- Get maximum x and y position. 
 - 
- 
move(y: int, x: int) → None[source]
- Move the mocked cursor. 
 - 
- 
resize(nlines: int, ncols: int) → None[source]
- A simple re-size method. 
 
- 
runtimepy.tui.mock.stage_char(data: int) → None[source]
- Stage an input character. 
- 
runtimepy.tui.mock.wrapper_mock(*args, **kwargs) → None[source]
- Create a virtual window. 
runtimepy.tui.task module
A task entry-point for a text user-interface.
- 
class runtimepy.tui.task.TuiTask(name: str, period_s: float, env: ChannelEnvironment, average_depth: int = 10, max_iterations: int = 0)[source]
- Bases: - AsyncTask
 - A task implementation for a text user-interface. - 
- 
async dispatch(*_, **__) → bool[source]
- Dispatch this task. 
 - 
- 
async init(*args, **__) → bool[source]
- Initialize this task. 
 - 
- 
init_channels(env: ChannelEnvironment) → None[source]
- Initialize task-specific channels.