diff --git a/src/textual/widget.py b/src/textual/widget.py index 4e73d3799a..05d99addc3 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -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()