diff --git a/README.md b/README.md index 916cdde..5a0eef0 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,11 @@ The TUI should now be discoverable as `vban-tui` vban-tui --host=localhost --port=6980 --streamname=Command1 ``` +Additional Flags: + +- --rich_log/--no-rich_log: Use this to [disable the RichLog window](./img/tui-no_log.png). + - This is useful if you're sending commands to Voicemeeter because you won't receive any responses anyway. + ### Environment Variables example .envrc: diff --git a/img/tui-no_log.png b/img/tui-no_log.png new file mode 100755 index 0000000..d2ce1ed Binary files /dev/null and b/img/tui-no_log.png differ diff --git a/src/vban_tui/settings.py b/src/vban_tui/settings.py index f8281e8..eb3d14f 100644 --- a/src/vban_tui/settings.py +++ b/src/vban_tui/settings.py @@ -27,6 +27,7 @@ class Settings(BaseSettings): host: Annotated[str, AfterValidator(is_valid_host)] = 'localhost' port: Annotated[int, AfterValidator(is_valid_port)] = 6980 streamname: Annotated[str, AfterValidator(is_valid_streamname)] = 'Command1' + rich_log: bool = True model_config = SettingsConfigDict( env_file=( diff --git a/src/vban_tui/tui.py b/src/vban_tui/tui.py index 38a3407..2f6341f 100644 --- a/src/vban_tui/tui.py +++ b/src/vban_tui/tui.py @@ -11,11 +11,15 @@ from .settings import Settings class VbanTui(App): """A Textual App to display VBAN data.""" - CSS_PATH = 'tui.tcss' + def _select_css(self): + if hasattr(self, '_settings') and not self._settings.rich_log: + return 'tui_no_log.tcss' + return 'tui.tcss' def __init__(self): - super().__init__() self._settings = Settings() + self.CSS_PATH = self._select_css() + super().__init__() self._command_history = CommandHistory() self._history_index = None @@ -62,6 +66,11 @@ class VbanTui(App): self.query_one('#request-input').focus() + if not self._settings.rich_log: + self.query_one('#response-log').remove() + self.query_one('#main-grid').styles.height = '20' + self.query_one('#main-grid').refresh(layout=True) + def on_key(self, event): """Handle key events.""" request_input = self.query_one('#request-input') diff --git a/src/vban_tui/tui_no_log.tcss b/src/vban_tui/tui_no_log.tcss new file mode 100644 index 0000000..3ab2ab5 --- /dev/null +++ b/src/vban_tui/tui_no_log.tcss @@ -0,0 +1,85 @@ +#main-grid { + height: 20; + margin: 1 2; + background: #232a38; + color: #f5e0dc; + border: heavy #a5b6d7; + border-title-color: #b7bdfc; + border-title-style: bold; + padding: 1 1; + grid-size: 3 2; + grid-gutter: 1 1; + grid-rows: 1fr 1fr; + grid-columns: 1fr 1fr 1fr; +} + +#host-labelinput { + height: auto; + width: 100%; + content-align: left middle; + text-align: left; + background: #3a415a; + border: solid #a5b6d7; + border-title-color: #b7bdfc; + padding: 0 1 0 1; + margin: 0 1 0 1; +} + +#host-label { + padding: 0 1; +} + +#port-labelinput { + height: auto; + width: 100%; + content-align: left middle; + text-align: left; + background: #3a415a; + border: solid #a5b6d7; + border-title-color: #b7bdfc; + padding: 0 1 0 1; + margin: 0 1 0 1; +} + +#port-label { + padding: 0 1; +} + +#streamname-labelinput { + height: auto; + width: 100%; + content-align: left middle; + text-align: left; + background: #3a415a; + border: solid #a5b6d7; + border-title-color: #c6a0f6; + padding: 0 1 0 1; + margin: 0 1 0 1; +} + +#streamname-label { + padding: 0 1; +} + +#request-labelinput { + height: auto; + width: 100%; + content-align: left middle; + text-align: left; + background: #3a415a; + border: solid #a5b6d7; + border-title-color: #b7bdfc; + padding: 0 1 0 1; + margin: 0 1 0 1; + column-span: 3; +} + +#request-label { + padding: 0 1; +} + +#request-input { + width: 100%; + display: block; +} +