conntextual.ui.channel package

Contents

conntextual.ui.channel package#

Submodules#

conntextual.ui.channel.color module#

A module implementing color interfaces for channel enviroments.

conntextual.ui.channel.color.bit_field_style() str[source]#

Get a style string for bit-field elements.

conntextual.ui.channel.color.type_str_style(kind: Int8Type | Int16Type | Int32Type | Int64Type | Uint8Type | Uint16Type | Uint32Type | Uint64Type | HalfType | FloatType | DoubleType | BooleanType, enum: RuntimeEnum | None) str[source]#

Get a style for a given type.

conntextual.ui.channel.environment module#

A module implementing user interface elements for channel environments.

class conntextual.ui.channel.environment.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.

highlight_style: Style | None#
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#
styles: RenderStyles#
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.

conntextual.ui.channel.log module#

A module impementing a channel-environment log widget.

class conntextual.ui.channel.log.ChannelEnvironmentLog(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 log widget.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose() Iterable[Widget][source]#

Create child nodes.

dispatch() None[source]#

Dispatch the log updater.

handle_submit(event: Submitted) None[source]#

Handle input submission.

logger: Logger | LoggerAdapter[Any]#
parent_name: str#
queue: SimpleQueue[LogRecord]#
suggester: CommandSuggester | None#
class conntextual.ui.channel.log.InputWithHistory(value: str | None = None, placeholder: str = '', highlighter: Highlighter | None = None, password: bool = False, *, restrict: str | None = None, type: Literal['integer', 'number', 'text'] = 'text', max_length: int = 0, suggester: Suggester | None = None, validators: Validator | Iterable[Validator] | None = None, validate_on: Iterable[Literal['blur', 'changed', 'submitted']] | None = None, valid_empty: bool = False, name: str | None = None, id: str | None = None, classes: str | None = None, disabled: bool = False)[source]#

Bases: Input

An input with last-command history.

BINDINGS: ClassVar[list[BindingType]] = [Binding(key='up', action='previous_command', description='previous command', show=True, key_display=None, priority=False)]#
Key(s) | Description |
:- | :- |
left | Move the cursor left. |
ctrl+left | Move the cursor one word to the left. |
right | Move the cursor right or accept the completion suggestion. |
ctrl+right | Move the cursor one word to the right. |
backspace | Delete the character to the left of the cursor. |
home,ctrl+a | Go to the beginning of the input. |
end,ctrl+e | Go to the end of the input. |
delete,ctrl+d | Delete the character to the right of the cursor. |
enter | Submit the current value of the input. |
ctrl+w | Delete the word to the left of the cursor. |
ctrl+u | Delete everything to the left of the cursor. |
ctrl+f | Delete the word to the right of the cursor. |
ctrl+k | Delete everything to the right of the cursor. |
action_previous_command() None[source]#

Go back to the previous command.

can_focus: bool = True#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

previous: str#

conntextual.ui.channel.model module#

A module implementing a data model for channel environments.

class conntextual.ui.channel.model.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'#
class conntextual.ui.channel.model.Model(name: str, command: ChannelCommandProcessor, source: ChannelEnvironmentSource, logger: Logger | LoggerAdapter[Any], app: AppInfo)[source]#

Bases: object

A model for channel environment displays.

app: AppInfo#
command: ChannelCommandProcessor#
property env: ChannelEnvironment#

Get the channel environment.

logger: Logger | LoggerAdapter[Any]#
name: str#
source: ChannelEnvironmentSource#

conntextual.ui.channel.pattern module#

A module implementing an include/exclude pattern matching interface.

class conntextual.ui.channel.pattern.PatternPair(includes: List[Pattern[str]], excludes: List[Pattern[str]])[source]#

Bases: NamedTuple

A container for managing pattern data.

excludes: List[Pattern[str]]#

Alias for field number 1

static from_dict(data: dict[str, str | List[str]]) PatternPair[source]#

Create a pattern pair from dictionary data.

includes: List[Pattern[str]]#

Alias for field number 0

matches(data: str) bool[source]#

Determine whether or not a string matches this pattern pair.

conntextual.ui.channel.plot module#

A module implementing a plot widget.

class conntextual.ui.channel.plot.Plot(x: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], y: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], theme: str, marker: str, *args, title: str = 'under construction', **kwargs)[source]#

Bases: PlotextPlot

A plot widget.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

dispatch() None[source]#

Draw a new instance of the plot.

on_mount() None[source]#

Initialize the plot.

on_resize() None[source]#

Handle re-size.

on_show() None[source]#

Handle showing the plot.

set_data(x: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], y: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) None[source]#

Assign new data.

update_title(name: str = None) None[source]#

Update the plot’s title.

conntextual.ui.channel.selected module#

A module implementing an interface for channel selection.

class conntextual.ui.channel.selected.SelectedChannel(name: str, channel: tuple[Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive], RuntimeEnum | None], timestamps: List[float], values: List[float | int | bool], start_ns: int)[source]#

Bases: object

A container for selected-channel information.

channel: tuple[Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive], RuntimeEnum | None]#
static create(name: str, channel: tuple[Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive], RuntimeEnum | None]) SelectedChannel[source]#

Create a selected-channel instance.

name: str#
poll(max_plot_samples: int) None[source]#

Poll the underlying channel.

reset() None[source]#

Reset this channel’s start time.

start_ns: int#
timestamps: List[float]#
values: List[float | int | bool]#

conntextual.ui.channel.suggester module#

A module implementing an input suggester for the channel-environment command widget.

class conntextual.ui.channel.suggester.CommandSuggester(*, use_cache: bool = True, case_sensitive: bool = False)[source]#

Bases: Suggester

An input suggester for channel environment commands.

static create(processor: ChannelCommandProcessor) CommandSuggester[source]#

A method for creating a command suggester.

async get_suggestion(value: str) str | None[source]#

Get an input suggestion.

processor: ChannelCommandProcessor#

Module contents#