Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,18 +953,15 @@ def get_loading_widget(self) -> Widget:
def set_loading(self, loading: bool) -> None:
"""Set or reset the loading state of this widget.

A widget in a loading state will display a LoadingIndicator that obscures the widget.
A widget in a loading state will display a `LoadingIndicator` or a custom widget
set through overriding the `get_loading_widget` method.

Args:
loading: `True` to put the widget into a loading state, or `False` to reset the loading state.

Returns:
An optional awaitable.
"""
LOADING_INDICATOR_CLASS = "-textual-loading-indicator"
if loading:
loading_indicator = self.get_loading_widget()
loading_indicator.add_class(LOADING_INDICATOR_CLASS)
loading_indicator.add_class("-textual-loading-indicator")
self._cover(loading_indicator)
else:
self._uncover()
Expand Down
Loading