add pause to action

This commit is contained in:
Will McGugan
2022-12-19 11:26:42 +00:00
parent 621e96dcdd
commit 002cbab0d5
3 changed files with 4 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ When you click any of the links, Textual runs the `"set_background"` action to c
## Bindings ## Bindings
Textual will also run actions bound to keys. The following example adds key [bindings](./input.md#bindings) for the ++r++, ++g++, and ++b++ keys which call the `"set_background"` action. Textual will run actions bound to keys. The following example adds key [bindings](./input.md#bindings) for the ++r++, ++g++, and ++b++ keys which call the `"set_background"` action.
=== "actions04.py" === "actions04.py"
@@ -92,7 +92,7 @@ If you run this example, you can change the background by pressing keys in addit
## Namespaces ## Namespaces
Textual will look for action methods on the widget or app where they are used. If we were to create a [custom widget](./widgets.md#custom-widgets) it can have its own set of actions. Textual will look for action methods in the class where they are defined (App, Screen, or Widget). If we were to create a [custom widget](./widgets.md#custom-widgets) it can have its own set of actions.
The following example defines a custom widget with its own `set_background` action. The following example defines a custom widget with its own `set_background` action.

View File

@@ -173,6 +173,6 @@ def test_demo(snap_compare):
"""Test the demo app (python -m textual)""" """Test the demo app (python -m textual)"""
assert snap_compare( assert snap_compare(
Path("../../src/textual/demo.py"), Path("../../src/textual/demo.py"),
press=["down", "down", "down"], press=["down", "down", "down", "_"],
terminal_size=(100, 30), terminal_size=(100, 30),
) )

View File

@@ -640,7 +640,7 @@ async def test_skip_action() -> None:
# Check the NoHandle widget has focus # Check the NoHandle widget has focus
assert pilot.app.query_one(NoHandle).has_focus assert pilot.app.query_one(NoHandle).has_focus
# Press the "t" key # Press the "t" key
await pilot.press("t", "_") await pilot.press("t")
# Check the action on the no handle widget was called # Check the action on the no handle widget was called
assert no_handle_invoked assert no_handle_invoked
# Check the return value, confirming that the action on Handle was called # Check the return value, confirming that the action on Handle was called