From c41c531431c565e723bed1fc7fc12dd53f14d491 Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:05:42 +0100 Subject: [PATCH] docs: update selection list messages docs (#4399) * remove selection toggled note * update selected changed docstring * add event handler to selected changed docstring * remove differentiation of user interaction and API --- docs/widgets/selection_list.md | 7 ------- src/textual/widgets/_selection_list.py | 12 ++---------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/docs/widgets/selection_list.md b/docs/widgets/selection_list.md index 73de670754..7ee5256661 100644 --- a/docs/widgets/selection_list.md +++ b/docs/widgets/selection_list.md @@ -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 diff --git a/src/textual/widgets/_selection_list.py b/src/textual/widgets/_selection_list.py index 7c0ee3f0a5..85f95b1326 100644 --- a/src/textual/widgets/_selection_list.py +++ b/src/textual/widgets/_selection_list.py @@ -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]