From 1ab1299997ca010cbc9cf2c5ce3b7464d7beb251 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Thu, 26 Sep 2024 15:05:11 +0100 Subject: [PATCH] Reviewing more binding descriptions --- src/textual/widgets/_button.py | 2 +- src/textual/widgets/_data_table.py | 12 +++--- src/textual/widgets/_list_view.py | 4 +- src/textual/widgets/_option_list.py | 4 +- src/textual/widgets/_select.py | 2 +- src/textual/widgets/_selection_list.py | 2 +- src/textual/widgets/_text_area.py | 54 +++++++++++++------------- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/textual/widgets/_button.py b/src/textual/widgets/_button.py index df39c5e491..dc9b4c84f6 100644 --- a/src/textual/widgets/_button.py +++ b/src/textual/widgets/_button.py @@ -146,7 +146,7 @@ class Button(Widget, can_focus=True): } """ - BINDINGS = [Binding("enter", "press", "Press Button", show=False)] + BINDINGS = [Binding("enter", "press", "Press button", show=False)] label: reactive[TextType] = reactive[TextType]("") """The text label that appears within the button.""" diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index 951dc133c7..5d9da649ca 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -261,12 +261,12 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True): BINDINGS: ClassVar[list[BindingType]] = [ Binding("enter", "select_cursor", "Select", show=False), - Binding("up", "cursor_up", "Cursor Up", show=False), - Binding("down", "cursor_down", "Cursor Down", show=False), - Binding("right", "cursor_right", "Cursor Right", show=False), - Binding("left", "cursor_left", "Cursor Left", show=False), - Binding("pageup", "page_up", "Page Up", show=False), - Binding("pagedown", "page_down", "Page Down", show=False), + Binding("up", "cursor_up", "Cursor up", show=False), + Binding("down", "cursor_down", "Cursor down", show=False), + Binding("right", "cursor_right", "Cursor right", show=False), + Binding("left", "cursor_left", "Cursor left", show=False), + Binding("pageup", "page_up", "Page up", show=False), + Binding("pagedown", "page_down", "Page down", show=False), Binding("ctrl+home", "scroll_top", "Top", show=False), Binding("ctrl+end", "scroll_bottom", "Bottom", show=False), Binding("home", "scroll_home", "Home", show=False), diff --git a/src/textual/widgets/_list_view.py b/src/textual/widgets/_list_view.py index 3e95f7fdbf..a60ddf8468 100644 --- a/src/textual/widgets/_list_view.py +++ b/src/textual/widgets/_list_view.py @@ -27,8 +27,8 @@ class ListView(VerticalScroll, can_focus=True, can_focus_children=False): BINDINGS: ClassVar[list[BindingType]] = [ Binding("enter", "select_cursor", "Select", show=False), - Binding("up", "cursor_up", "Cursor Up", show=False), - Binding("down", "cursor_down", "Cursor Down", show=False), + Binding("up", "cursor_up", "Cursor up", show=False), + Binding("down", "cursor_down", "Cursor down", show=False), ] """ | Key(s) | Description | diff --git a/src/textual/widgets/_option_list.py b/src/textual/widgets/_option_list.py index 10221cbfc9..5963052c80 100644 --- a/src/textual/widgets/_option_list.py +++ b/src/textual/widgets/_option_list.py @@ -119,8 +119,8 @@ class OptionList(ScrollView, can_focus=True): Binding("end", "last", "Last", show=False), Binding("enter", "select", "Select", show=False), Binding("home", "first", "First", show=False), - Binding("pagedown", "page_down", "Page Down", show=False), - Binding("pageup", "page_up", "Page Up", show=False), + Binding("pagedown", "page_down", "Page down", show=False), + Binding("pageup", "page_up", "Page up", show=False), Binding("up", "cursor_up", "Up", show=False), ] """ diff --git a/src/textual/widgets/_select.py b/src/textual/widgets/_select.py index 284668723f..aa78f31b31 100644 --- a/src/textual/widgets/_select.py +++ b/src/textual/widgets/_select.py @@ -43,7 +43,7 @@ class EmptySelectError(Exception): class SelectOverlay(OptionList): """The 'pop-up' overlay for the Select control.""" - BINDINGS = [("escape", "dismiss")] + BINDINGS = [("escape", "dismiss", "Dismiss menu")] DEFAULT_CSS = """ SelectOverlay { diff --git a/src/textual/widgets/_selection_list.py b/src/textual/widgets/_selection_list.py index 00f3a09b92..8e9422948c 100644 --- a/src/textual/widgets/_selection_list.py +++ b/src/textual/widgets/_selection_list.py @@ -71,7 +71,7 @@ def initial_state(self) -> bool: class SelectionList(Generic[SelectionType], OptionList): """A vertical selection list that allows making multiple selections.""" - BINDINGS = [Binding("space", "select")] + BINDINGS = [Binding("space", "select", "Toggle option")] """ | Key(s) | Description | | :- | :- | diff --git a/src/textual/widgets/_text_area.py b/src/textual/widgets/_text_area.py index 970e5f5feb..b147c27ee5 100644 --- a/src/textual/widgets/_text_area.py +++ b/src/textual/widgets/_text_area.py @@ -167,63 +167,63 @@ class TextArea(ScrollView): BINDINGS = [ # Cursor movement - Binding("up", "cursor_up", "cursor up", show=False), - Binding("down", "cursor_down", "cursor down", show=False), - Binding("left", "cursor_left", "cursor left", show=False), - Binding("right", "cursor_right", "cursor right", show=False), - Binding("ctrl+left", "cursor_word_left", "cursor word left", show=False), - Binding("ctrl+right", "cursor_word_right", "cursor word right", show=False), - Binding("home,ctrl+a", "cursor_line_start", "cursor line start", show=False), - Binding("end,ctrl+e", "cursor_line_end", "cursor line end", show=False), - Binding("pageup", "cursor_page_up", "cursor page up", show=False), - Binding("pagedown", "cursor_page_down", "cursor page down", show=False), + Binding("up", "cursor_up", "Cursor up", show=False), + Binding("down", "cursor_down", "Cursor down", show=False), + Binding("left", "cursor_left", "Cursor left", show=False), + Binding("right", "cursor_right", "Cursor right", show=False), + Binding("ctrl+left", "cursor_word_left", "Cursor word left", show=False), + Binding("ctrl+right", "cursor_word_right", "Cursor word right", show=False), + Binding("home,ctrl+a", "cursor_line_start", "Cursor line start", show=False), + Binding("end,ctrl+e", "cursor_line_end", "Cursor line end", show=False), + Binding("pageup", "cursor_page_up", "Cursor page up", show=False), + Binding("pagedown", "cursor_page_down", "Cursor page down", show=False), # Making selections (generally holding the shift key and moving cursor) Binding( "ctrl+shift+left", "cursor_word_left(True)", - "cursor left word select", + "Cursor left word select", show=False, ), Binding( "ctrl+shift+right", "cursor_word_right(True)", - "cursor right word select", + "Cursor right word select", show=False, ), Binding( "shift+home", "cursor_line_start(True)", - "cursor line start select", + "Cursor line start select", show=False, ), Binding( - "shift+end", "cursor_line_end(True)", "cursor line end select", show=False + "shift+end", "cursor_line_end(True)", "Cursor line end select", show=False ), - Binding("shift+up", "cursor_up(True)", "cursor up select", show=False), - Binding("shift+down", "cursor_down(True)", "cursor down select", show=False), - Binding("shift+left", "cursor_left(True)", "cursor left select", show=False), - Binding("shift+right", "cursor_right(True)", "cursor right select", show=False), + Binding("shift+up", "cursor_up(True)", "Cursor up select", show=False), + Binding("shift+down", "cursor_down(True)", "Cursor down select", show=False), + Binding("shift+left", "cursor_left(True)", "Cursor left select", show=False), + Binding("shift+right", "cursor_right(True)", "Cursor right select", show=False), # Shortcut ways of making selections # Binding("f5", "select_word", "select word", show=False), - Binding("f6", "select_line", "select line", show=False), - Binding("f7", "select_all", "select all", show=False), + Binding("f6", "select_line", "Select line", show=False), + Binding("f7", "select_all", "Select all", show=False), # Deletion - Binding("backspace", "delete_left", "delete left", show=False), + Binding("backspace", "delete_left", "Delete character left", show=False), Binding( - "ctrl+w", "delete_word_left", "delete left to start of word", show=False + "ctrl+w", "delete_word_left", "Delete left to start of word", show=False ), - Binding("delete,ctrl+d", "delete_right", "delete right", show=False), + Binding("delete,ctrl+d", "delete_right", "Delete character right", show=False), Binding( - "ctrl+f", "delete_word_right", "delete right to start of word", show=False + "ctrl+f", "delete_word_right", "Delete right to start of word", show=False ), - Binding("ctrl+x", "delete_line", "delete line", show=False), + Binding("ctrl+x", "delete_line", "Delete line", show=False), Binding( - "ctrl+u", "delete_to_start_of_line", "delete to line start", show=False + "ctrl+u", "delete_to_start_of_line", "Delete to line start", show=False ), Binding( "ctrl+k", "delete_to_end_of_line_or_delete_line", - "delete to line end", + "Delete to line end", show=False, ), Binding("ctrl+z", "undo", "Undo", show=False),