API reference¶
This section documents the complete application programming interface (API) of Valmix. If you are new to Valmix, you may want to read the usage guide in the readme first.
Knobs¶
Knob interface.
- class valmix.knob.Knob(name, value, values)¶
Name and list values for a target quantity.
- advance(step)¶
Advance to the next value listed when configuring the knob.
- Parameters:
step (
int
) – Number of steps to add to the list index.- Return type:
None
- property current_index: int¶
Get current index in the list of available values.
- Returns:
Current index of the knob.
- property name: str¶
Knob name to display.
- property nb_values: int¶
Get the number of different values that the knob can take.
- Returns:
Number of different values that the knob can take.
- property value: int | float¶
Get current value of the knob.
- Returns:
Current value of the knob.
TUI¶
Main application screen.
- class valmix.app.App(knobs)¶
Valmix application.
- knobs¶
Knobs manipulated via the app interface.
- BINDINGS: ClassVar[list[BindingType]] = [Binding(key='down,j', action='next', description='Next', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='up,k', action='previous', description='Previous', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='left,h', action='decrease', description='Decrease', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='right,l', action='increase', description='Increase', show=True, key_display=None, priority=False, tooltip='', id=None, system=False), Binding(key='q', action='quit', description='Quit', show=True, key_display=None, priority=False, tooltip='', id=None, system=False)]¶
The default key bindings.
- TITLE: str | None = 'Valmix'¶
A class variable to set the default title for the application.
To update the title while the app is running, you can set the [title][textual.app.App.title] attribute. See also [the Screen.TITLE attribute][textual.screen.Screen.TITLE].
- action_decrease()¶
Decrease currently-selected knob.
- Return type:
None
- action_increase()¶
Increase currently-selected knob.
- Return type:
None
- action_next()¶
Focus next knob.
- Return type:
None
- action_previous()¶
Focus previous knob.
- Return type:
None
- compose()¶
Compose the application screen.
- Return type:
Iterable
[Widget
]
KnobWidget widget definition.
- class valmix.knob_widget.KnobWidget(knob)¶
Widget combining a focus button, a progress bar and a value label.
- knob¶
Knob associated with the widget.
- DEFAULT_CSS: ClassVar[str] = '\n\n KnobWidget {\n height: 3;\n layout: horizontal;\n }\n\n KnobWidget Button,\n KnobWidget Button:enabled, {\n border: wide $primary;\n margin: 0 2;\n width: 3;\n }\n\n KnobWidget Button:focus {\n background: $accent;\n }\n\n KnobWidget ProgressBar {\n margin: 1 3;\n width: 6fr;\n }\n\n KnobWidget Bar {\n width: 1fr;\n }\n\n KnobWidget PercentageStatus {\n display: none;\n }\n\n KnobWidget Label {\n margin: 1 2;\n width: 8;\n }\n\n '¶
Default TCSS.
- advance(step)¶
Advance the underlying knob by a number of steps.
- Parameters:
step (
int
) – Number of steps to add to advance the knob by.
- can_focus: bool = False¶
Widget may receive focus.
- can_focus_children: bool = True¶
Widget’s children may receive focus.
- compose()¶
Render the widget.
- Return type:
Iterable
[Widget
]