Skip to content

Commit

Permalink
docs: update selection list messages docs (#4399)
Browse files Browse the repository at this point in the history
* remove selection toggled note

* update selected changed docstring

* add event handler to selected changed docstring

* remove differentiation of user interaction and API
  • Loading branch information
TomJGooding authored Apr 16, 2024
1 parent dd36d6f commit c41c531
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
7 changes: 0 additions & 7 deletions docs/widgets/selection_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,8 @@ collection of selected values:

## Messages

The following messages will be posted as the user interacts with the list:

- [SelectionList.SelectionHighlighted][textual.widgets.SelectionList.SelectionHighlighted]
- [SelectionList.SelectionToggled][textual.widgets.SelectionList.SelectionToggled]

The following message will be posted if the content of
[`selected`][textual.widgets.SelectionList.selected] changes, either by user
interaction or by API calls:

- [SelectionList.SelectedChanged][textual.widgets.SelectionList.SelectedChanged]

## Bindings
Expand Down
12 changes: 2 additions & 10 deletions src/textual/widgets/_selection_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,14 @@ class SelectionToggled(SelectionMessage[MessageSelectionType]):
Can be handled using `on_selection_list_selection_toggled` in a subclass of
[`SelectionList`][textual.widgets.SelectionList] or in a parent node in the DOM.
Note:
This message is only sent if the selection is toggled by user
interaction. See
[`SelectedChanged`][textual.widgets.SelectionList.SelectedChanged]
for a message sent when any change (selected or deselected,
either by user interaction or by API calls) is made to the
selected values.
"""

@dataclass
class SelectedChanged(Generic[MessageSelectionType], Message):
"""Message sent when the collection of selected values changes.
This message is sent when any change to the collection of selected
values takes place; either by user interaction or by API calls.
Can be handled using `on_selection_list_selected_changed` in a subclass of
[`SelectionList`][textual.widgets.SelectionList] or in a parent node in the DOM.
"""

selection_list: SelectionList[MessageSelectionType]
Expand Down

0 comments on commit c41c531

Please sign in to comment.