Skip to content

Commit ac2e294

Browse files
committed
Use bottom_toolbar_mode in the Textual toolbar example
The example came from main, where the toolbar is turned on and off with enable_bottom_toolbar. This branch replaced that argument with bottom_toolbar_mode, so the example failed to start with a TypeError. Ask for ToolbarMode.AUTO on its own, as getting_started.py does, and for ToolbarMode.OFF inside the Textual application, and say so in the docs.
1 parent c06ef52 commit ac2e294

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎docs/examples/embedding_in_textual.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ uv run examples/textual_tty_toolbar.py
134134
Try `slow`, `burst 2000 1`, or resizing the window while a command runs. Pass `--cmd2-only` to see
135135
what `cmd2` does without Textual, where the toolbar disappears for as long as a command runs.
136136

137-
Here the `cmd2` application doesn't draw the toolbar at all. It passes `enable_bottom_toolbar=False`
138-
to [cmd2.Cmd.__init__][] when it is running inside the Textual application, and sends what
139-
`get_bottom_toolbar()` returns to the Textual application, which shows it in a widget of its own:
137+
Here the `cmd2` application doesn't draw the toolbar at all. It passes
138+
`bottom_toolbar_mode=cmd2.ToolbarMode.OFF` to [cmd2.Cmd.__init__][] when it is running inside the
139+
Textual application, and sends what `get_bottom_toolbar()` returns to the Textual application, which
140+
shows it in a widget of its own:
140141

141142
```py
142143
def compose(self) -> ComposeResult:

‎examples/textual_tty_toolbar.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def __init__(self, toolbar_socket: str | None) -> None:
177177
refresh_interval = 0.5
178178
super().__init__(
179179
allow_cli_args=False,
180-
# Inside the Textual application, don't have prompt-toolkit draw a second toolbar in the terminal pane
181-
enable_bottom_toolbar=toolbar_socket is None,
180+
# Inside the Textual application, don't have cmd2 draw a second toolbar in the terminal pane
181+
bottom_toolbar_mode=cmd2.ToolbarMode.AUTO if toolbar_socket is None else cmd2.ToolbarMode.OFF,
182182
refresh_interval=refresh_interval,
183183
)
184184
self.prompt = "toolbar-demo> "

0 commit comments

Comments
 (0)