-
Notifications
You must be signed in to change notification settings - Fork 0
vtf io modem
The module contains concepts for the complete processing of inputs. These are based on the input types from io and uses the binder module.
class modem.InputModem(Input) ¶
Input
type as an overall concept for processing inputs via stdin.When the thread is started, inputs are continuously read from stdin, parsed/interpreted and passed to the binder.
stdin --> interpreter --> [ SpamHandler ] --> binder
The send method is also an indirect interface from input to the binder.
See also documentation of Input and Binder
__binder__: Binder
__init__(thread_smoothness=.003, thread_block=False, thread_spam=SpamHandle(), mod=True, find_all_bindings=False, find_instance_bindings_only=False, find_class_bindings_first=False, use_alter_bindings=False) ¶
run() -> None ¶
Read with or without blocking (
self.t_block
) whileself.t_keepalive
isTrue
and send the objects to the binder. Waitself.t_smoothness
seconds in an iteration ifself.t_block
isFalse
.
stdin --> interpreter --> [ SpamHandler ] --> binder
send(block=False) -> bool ¶
Read with or without blocking and send the object to the binder.
Returns whether something was executed
class modem.InputSuperModem(InputSuper) ¶
InputSuper
type as an overall concept for processing inputs via stdin.When the thread is started, inputs are continuously read from stdin, parsed/interpreted and passed to the binder.
adapter --> interpreter --> [ SpamHandler ] --> binder
The send method is also an indirect interface from input to the binder.
See also documentation of InputSuper and Binder.
__binder__: Binder
__init__(thread_smoothness=.003, thread_block=False, thread_spam=SpamHandle(), manual_esc_tt=.8, manual_esc_finals=(0xa, 0xd, 0x1b), find_all_bindings=False, find_instance_bindings_only=False, find_class_bindings_first=False, use_alter_bindings=False) ¶
run() -> None ¶
Read with or without blocking (
self.t_block
) whileself.t_keepalive
isTrue
and send the objects to the binder. Waitself.t_smoothness
seconds in an iteration ifself.t_block
isFalse
.
stdin --> adapter --> interpreter --> [ SpamHandler ] --> binder
Recognize and supervise manual input of esc.
send(block=False) -> bool ¶
Read with or without blocking and send the object to the binder.
Returns whether something was executed
class modem.InputRouter(Thread) ¶
This object offers a central handling for several InputModem | InputSuperModem objects.
If the thread is started, inputs are processed from the modem defined as
current_modem
continuously. The methodsend
is also oriented to thecurrent_modem
and processes one input [ in blocking mode ].Before any of the actions can be performed, entries must be entered and
switch_gate
must be executed a first time. Entries can be created during the initialization or afterwards via methods.>>> router = InputRouter(main_modem=<InputModem>) >>> >>> router.setdefault_table_entry(42, <InputSuperModem>) >>> router[object] = <InputModem> >>> >>> router.switch_gate("main_modem") >>> >>> router.start(daemon=True)current_modem: InputModem | InputSuperModem
t_block: bool
t_keepalive: bool
t_smoothness: float
__contains__(entry) -> bool ¶
entry in table
__delitem__(entry) -> None ¶
del router[modem entry]
raises:
- KeyError(entry)
__getitem__(entry) -> InputModem | InputSuperModem ¶
modem = router[modem entry]
raises:
- KeyError(entry)
__init__(thread_smoothness=.003, thread_block=False, **modems) ¶
The thread loop can be slowed down for a smoother run over thread_smoothness. If thread_block isTrue
, this parameter is ignored and blocking read from stdin is enabled.__setitem__(entry, modem) -> None ¶
router[modem entry] = modem
add_table_entry(entry, modem) -> None ¶
Add a table entry.
raises:
- KeyError(entry): entry is already set
entries() -> Iterable[Hashable] ¶
Iterable[entry keys]
modems() -> Iterable[InputModem | InputSuperModem] ¶
Iterable[modems]
pop_table_entry(entry) -> InputModem | InputSuperModem | None ¶
Pop an entry from the table. Returns the modem entry orNone
.run() -> None ¶
Process inputs from stdin [ in blocking mode (self.t_block
) ] by the modem defined ascurrent_modem
whileself.t_keepalive
isTrue
. Waitself.t_smoothness
seconds in an iteration ifself.t_block
isFalse
.send(block=False) -> bool ¶
Process an input from stdin by thecurrent_modem
[ in blocking mode ].set_table_entry(entry, modem) -> None ¶
Set a table entry.setdefault_table_entry(entry, modem) -> bool ¶
Set default table entry.
Returns whether the entry was free and modem was thus set.
start(*, daemon=True) -> None ¶
[Re-]Start the thread [ as daemon ].stop() -> None ¶
Stop the thread loop inself.run
.switch_gate(entry) -> None ¶
setcurrent_modem
table_items() -> Iterable[tuple[Hashable, InputModem | InputSuperModem]] ¶
Iterable[(entry key, modem)]
Date: | 15 Nov 2022 |
---|---|
Version: | 0.1 |
Author: | Adrian Hoefflin [srccircumflex] |
Doc-Generator: | "pyiStructure-RSTGenerator" <prototype> |