conntextual.ui package

Contents

conntextual.ui package#

Subpackages#

Submodules#

conntextual.ui.base module#

A module implementing a user interface base application.

class conntextual.ui.base.Base(driver_class: Type[Driver] | None = None, css_path: str | PurePath | List[str | PurePath] | None = None, watch_css: bool = False)[source]#

Bases: App[None]

A simple textual application.

BINDINGS: ClassVar[list[BindingType]] = [('q', 'quit'), (Keys.Escape, 'quit', '(or q) quit'), ('space', 'toggle_pause', 'toggle pause'), ('d', 'toggle_dark', 'toggle dark mode'), ('g', 'screenshot', 'take a screenshot'), ('r', 'refresh_plot', 'refresh plot'), ('R', 'random_channel', 'plot random channel'), Binding(key=<Keys.Tab: 'tab'>, action='tab(True)', description='Next tab', show=True, key_display=None, priority=True), Binding(key=<Keys.BackTab: 'shift+tab'>, action='tab(False)', description='Previous tab', show=True, key_display=None, priority=True)]#
CSS_PATH: ClassVar[CSSPathType | None] = PosixPath('/home/vkottler/src/vkottler/workspace/conntextual/conntextual/data/tcss/base.tcss')#

File paths to load CSS from.

async action_quit() None[source]#

Stop the rest of the application when quitting.

action_random_channel() None[source]#

Randomize the channel on the current tab.

action_refresh_plot() None[source]#

Refresh the current plot.

action_tab(forward: bool) None[source]#

Change the active tab.

action_toggle_pause() None[source]#

Toggle pause state.

compose() Iterable[Widget][source]#

Create child nodes.

compose_app() Iterable[Widget][source]#

Application-specific interface creation.

composed: Event#
static create(app: AppInfo, env: ChannelEnvironment, handle_debug: bool = True) Base[source]#

Create an application instance.

property current_channel_environment: ChannelEnvironmentDisplay | None#

Get the current channel-environment display.

dispatch(max_plot_samples: int, update_table: bool = True, update_log: bool = True, update_plot: bool = True) None[source]#

Update channel values.

model: Model#
tab_pattern: PatternPair#
property tabs: TabbedContent#

Get the tab container.

ui_enabled(name: str) bool[source]#

Determine if a task tab should be created for a task with a given name.

conntextual.ui.footer module#

A module implementing a custom footer widget.

class conntextual.ui.footer.CustomFooter[source]#

Bases: Footer

An extension of the footer widget.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

current_tab: str | None#
render() ConsoleRenderable | RichCast | str[source]#

Render the footer.

conntextual.ui.model module#

A module implementing a data model for base applications.

class conntextual.ui.model.Model(app: AppInfo, env: ChannelEnvironment, environments: List[ChannelEnvironmentDisplay], uptime: DoublePrimitive, paused: BooleanPrimitive, start: float, tab_to_id: dict[str, str])[source]#

Bases: ChannelEnvironmentMixin

A base application model.

app: AppInfo#
static create(app: AppInfo, env: ChannelEnvironment) Model[source]#

Create a model instance.

env: ChannelEnvironment#
environments: List[ChannelEnvironmentDisplay]#
paused: BooleanPrimitive#
start: float#
tab_to_id: dict[str, str]#
uptime: DoublePrimitive#

conntextual.ui.task module#

A module implementing a TUI application task.

class conntextual.ui.task.TuiDispatch[source]#

Bases: TaskFactory[TuiDispatchTask]

A factory for the TUI dispatch task.

kind#

alias of TuiDispatchTask

class conntextual.ui.task.TuiDispatchTask(name: str, average_depth: int = 10, metrics: PeriodicTaskMetrics = None, period_s: float = 1.0, env: ChannelEnvironment = None)[source]#

Bases: ArbiterTask

A class implementing a periodic task for a textual TUI.

async dispatch() bool[source]#

Dispatch an iteration of this task.

async init(app: AppInfo) None[source]#

Initialize this task with application information.

poll_housekeeping() None[source]#

Update housekeeping metrics.

process: Process#
async stop_extra() None[source]#

Extra actions to perform when this task is stopping.

tui: Base#
tui_task: Task[None]#

Module contents#

A module implementing a basic user interface.

class conntextual.ui.Base(driver_class: Type[Driver] | None = None, css_path: str | PurePath | List[str | PurePath] | None = None, watch_css: bool = False)[source]#

Bases: App[None]

A simple textual application.

BINDINGS: ClassVar[list[BindingType]] = [('q', 'quit'), (Keys.Escape, 'quit', '(or q) quit'), ('space', 'toggle_pause', 'toggle pause'), ('d', 'toggle_dark', 'toggle dark mode'), ('g', 'screenshot', 'take a screenshot'), ('r', 'refresh_plot', 'refresh plot'), ('R', 'random_channel', 'plot random channel'), Binding(key=<Keys.Tab: 'tab'>, action='tab(True)', description='Next tab', show=True, key_display=None, priority=True), Binding(key=<Keys.BackTab: 'shift+tab'>, action='tab(False)', description='Previous tab', show=True, key_display=None, priority=True)]#
CSS_PATH: ClassVar[CSSPathType | None] = PosixPath('/home/vkottler/src/vkottler/workspace/conntextual/conntextual/data/tcss/base.tcss')#

File paths to load CSS from.

async action_quit() None[source]#

Stop the rest of the application when quitting.

action_random_channel() None[source]#

Randomize the channel on the current tab.

action_refresh_plot() None[source]#

Refresh the current plot.

action_tab(forward: bool) None[source]#

Change the active tab.

action_toggle_pause() None[source]#

Toggle pause state.

animation_level: AnimationLevel#

Determines what type of animations the app will display.

See [textual.constants.TEXTUAL_ANIMATIONS][textual.constants.TEXTUAL_ANIMATIONS].

app_resume_signal: Signal[App]#

The signal that is published when the app is resumed after a suspend.

When the app is resumed after a [App.suspend][textual.app.App.suspend] call this signal will be [published][textual.signal.Signal.publish]; [subscribe][textual.signal.Signal.subscribe] to this signal to perform work after the app has resumed.

app_suspend_signal: Signal[App]#

The signal that is published when the app is suspended.

When [App.suspend][textual.app.App.suspend] is called this signal will be [published][textual.signal.Signal.publish]; [subscribe][textual.signal.Signal.subscribe] to this signal to perform work before the suspension takes place.

compose() Iterable[Widget][source]#

Create child nodes.

compose_app() Iterable[Widget][source]#

Application-specific interface creation.

composed: Event#
static create(app: AppInfo, env: ChannelEnvironment, handle_debug: bool = True) Base[source]#

Create an application instance.

property current_channel_environment: ChannelEnvironmentDisplay | None#

Get the current channel-environment display.

devtools: DevtoolsClient | None#
dispatch(max_plot_samples: int, update_table: bool = True, update_log: bool = True, update_plot: bool = True) None[source]#

Update channel values.

features: frozenset[FeatureFlag]#
model: Model#
mouse_captured: Widget | None#
mouse_over: Widget | None#
scroll_sensitivity_x: float#

Number of columns to scroll in the X direction with wheel or trackpad.

scroll_sensitivity_y: float#

Number of lines to scroll in the Y direction with wheel or trackpad.

styles: RenderStyles#
tab_pattern: PatternPair#
property tabs: TabbedContent#

Get the tab container.

ui_enabled(name: str) bool[source]#

Determine if a task tab should be created for a task with a given name.

use_command_palette: bool#

A flag to say if the application should use the command palette.

If set to False any call to [action_command_palette][textual.app.App.action_command_palette] will be ignored.

class conntextual.ui.ChannelEnvironmentDisplay(renderable: ConsoleRenderable | RichCast | str = '', *, expand: bool = False, shrink: bool = False, markup: bool = True, name: str | None = None, id: str | None = None, classes: str | None = None, disabled: bool = False)[source]#

Bases: Static

A channel-environment interface element.

add_channel(name: str, chan: Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive], enum: RuntimeEnum | None) int[source]#

Add a channel to the table.

add_field(name: str) None[source]#

Add a bit-field row entry.

by_index: List[Tuple[Coordinate, str | int]]#
can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

channel_pattern: PatternPair#
channels_by_row: Dict[int, SelectedChannel]#
compose() Iterable[Widget][source]#

Create child nodes.

static create(name: str, command: ChannelCommandProcessor, source: ChannelEnvironmentSource, logger: Logger | LoggerAdapter[Any], app: AppInfo, channel_pattern: PatternPair) ChannelEnvironmentDisplay[source]#

Create a channel-environment display.

handle_cell_selected(event: CellSelected) None[source]#

Handle input submission.

property label: str#

Obtain a label string for this instance.

model: Model#
on_mount() None[source]#

Populate channel table.

random_channel() None[source]#

Switch to a random channel.

reset_plot() None[source]#

Reset the selected plot.

row_idx: int#
selected: SelectedChannel#
switch_to_channel(row: int) None[source]#

Switch the plot to a channel at the specified row.

update_channels(max_plot_samples: int, update_table: bool = True, update_log: bool = True, update_plot: bool = True) None[source]#

Update all channel values.

class conntextual.ui.ChannelEnvironmentSource(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: StrEnum

Possible sources of channel environments.

CONNECTION_LOCAL = 'local connection'#
CONNECTION_REMOTE = 'remote connection'#
TASK = 'task'#
async conntextual.ui.test(app: AppInfo) int[source]#

Run a textual application.