Fix: rename loading -> refreshing (avoid built-in dots indicator)

This commit is contained in:
2026-09-10 13:00:52 +03:00
parent 8c374ea4e8
commit 36d2f5aac6
+5 -5
View File
@@ -134,7 +134,7 @@ class DashboardScreen(Screen[Any]):
] ]
data = reactive(DashboardData()) data = reactive(DashboardData())
loading = reactive(False) refreshing = reactive(False)
def __init__( def __init__(
self, self,
@@ -169,22 +169,22 @@ class DashboardScreen(Screen[Any]):
@work(exclusive=True, group="refresh") @work(exclusive=True, group="refresh")
async def _refresh(self) -> None: async def _refresh(self) -> None:
self.loading = True self.refreshing = True
try: try:
self.data = await self._service.refresh() self.data = await self._service.refresh()
except Exception as exc: # noqa: BLE001 - показываем toast при ошибке except Exception as exc: # noqa: BLE001 - показываем toast при ошибке
self.notify(f"Ошибка обновления: {exc}", severity="error") self.notify(f"Ошибка обновления: {exc}", severity="error")
finally: finally:
self.loading = False self.refreshing = False
def watch_loading(self, loading: bool) -> None: def watch_refreshing(self, refreshing: bool) -> None:
"""Показать/скрыть собачку и строку прогресса при обновлении.""" """Показать/скрыть собачку и строку прогресса при обновлении."""
try: try:
loader = self.query_one("#dog-loader", DogLoader) loader = self.query_one("#dog-loader", DogLoader)
line = self.query_one("#progress-line", Static) line = self.query_one("#progress-line", Static)
except NoMatches: # watcher может сработать до монтирования детей except NoMatches: # watcher может сработать до монтирования детей
return return
if loading: if refreshing:
loader.add_class("visible") loader.add_class("visible")
loader.start() loader.start()
line.update("[b]🐕 Собачка обновляет статистику…[/]") line.update("[b]🐕 Собачка обновляет статистику…[/]")