Skip to content

Commit

Permalink
Remove 'action' column from bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigogiraoserrao committed Jan 25, 2023
1 parent 2ea501e commit b63e236
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
6 changes: 3 additions & 3 deletions src/textual/widgets/_checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class Checkbox(Widget, can_focus=True):
Binding("enter,space", "toggle", "Toggle", show=False),
]
"""
| Key(s) | Action | Description |
| :- | :- | :- |
| enter,space | [toggle][textual.widgets.Checkbox.toggle] | Toggle |
| Key(s) | Description |
| :- | :- |
| enter,space | Toggle the checkbox status. |
"""

COMPONENT_CLASSES: ClassVar[set[str]] = {
Expand Down
14 changes: 7 additions & 7 deletions src/textual/widgets/_data_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
Binding("left", "cursor_left", "Cursor Left", show=False),
]
"""
| Key(s) | Action | Description |
| :- | :- | :- |
| enter | [select_cursor][textual.widgets.DataTable.select_cursor] | Select cells under the cursor. |
| up | [cursor_up][textual.widgets.DataTable.cursor_up] | Move the cursor up. |
| down | [cursor_down][textual.widgets.DataTable.cursor_down] | Move the cursor down. |
| right | [cursor_right][textual.widgets.DataTable.cursor_right] | Move the cursor right. |
| left | [cursor_left][textual.widgets.DataTable.cursor_left] | Move the cursor left. |
| Key(s) | Description |
| :- | :- |
| enter | Select cells under the cursor. |
| up | Move the cursor up. |
| down | Move the cursor down. |
| right | Move the cursor right. |
| left | Move the cursor left. |
"""

COMPONENT_CLASSES: ClassVar[set[str]] = {
Expand Down
18 changes: 9 additions & 9 deletions src/textual/widgets/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ class Input(Widget, can_focus=True):
Binding("enter", "submit", "submit", show=False),
]
"""
| Key(s) | Action | Description |
| :- | :- | :- |
| left | [cursor_left][textual.widgets.Input.cursor_left] | Move the cursor left. |
| right | [cursor_right][textual.widgets.Input.cursor_right] | Move the cursor right. |
| backspace | [delete_left][textual.widgets.Input.delete_left] | Delete the character to the left of the cursor. |
| home | [home][textual.widgets.Input.home] | Go to the beginning of the input. |
| end | [end][textual.widgets.Input.end] | Go to the end of the input. |
| ctrl+d | [delete_right][textual.widgets.Input.delete_right] | Delete the character to the right of the cursor. |
| enter | [submit][textual.widgets.Input.submit] | Submit the current value of the input. |
| Key(s) | Description |
| :- | :- |
| left | Move the cursor left. |
| right | Move the cursor right. |
| backspace | Delete the character to the left of the cursor. |
| home | Go to the beginning of the input. |
| end | Go to the end of the input. |
| ctrl+d | Delete the character to the right of the cursor. |
| enter | Submit the current value of the input. |
"""

COMPONENT_CLASSES: ClassVar[set[str]] = {"input--cursor", "input--placeholder"}
Expand Down
10 changes: 5 additions & 5 deletions src/textual/widgets/_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class ListView(Vertical, can_focus=True, can_focus_children=False):
Binding("down", "cursor_down", "Cursor Down", show=False),
]
"""
| Key(s) | Action | Description |
| :- | :- | :- |
| enter | [select_cursor][textual.widgets.ListView.select_cursor] | Select the current item. |
| up | [cursor_up][textual.widgets.ListView.cursor_up] | Move the cursor up. |
| down | [cursor_down][textual.widgets.ListView.cursor_down] | Move the cursor down. |
| Key(s) | Description |
| :- | :- |
| enter | Select the current item. |
| up | Move the cursor up. |
| down | Move the cursor down. |
"""

index = reactive(0, always_update=True)
Expand Down
10 changes: 5 additions & 5 deletions src/textual/widgets/_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
Binding("down", "cursor_down", "Cursor Down", show=False),
]
"""
| Key(s) | Action | Description |
| :- | :- | :- |
| enter | [select_cursor][textual.widgets.Tree.select_cursor] | Select the current item. |
| up | [cursor_up][textual.widgets.Tree.cursor_up] | Move the cursor up. |
| down | [cursor_down][textual.widgets.Tree.cursor_down] | Move the cursor down. |
| Key(s) | Description |
| :- | :- |
| enter | Select the current item. |
| up | Move the cursor up. |
| down | Move the cursor down. |
"""

COMPONENT_CLASSES: ClassVar[set[str]] = {
Expand Down
8 changes: 3 additions & 5 deletions tools/widget_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ def print_bindings(widget: str, bindings: list[Binding]) -> None:
if bindings:
print("BINDINGS")
print('"""')
print("| Key(s) | Action | Description |")
print("| :- | :- | :- |")
print("| Key(s) | Description |")
print("| :- | :- |")

for binding in bindings:
print(
f"| {binding.key} | [{binding.action}][textual.widgets.{widget}.{binding.action}] | {binding.description} |"
)
print(f"| {binding.key} | {binding.description} |")

if bindings:
print('"""')
Expand Down

0 comments on commit b63e236

Please sign in to comment.