Remove 'action' column from bindings.

This commit is contained in:
Rodrigo Girão Serrão
2023-01-25 15:00:45 +00:00
parent 2ea501ea9b
commit b63e2366e1
6 changed files with 32 additions and 34 deletions

View File

@@ -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]] = {

View File

@@ -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]] = {

View File

@@ -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"}

View File

@@ -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)

View File

@@ -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]] = {

View File

@@ -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('"""')