Initial upload: DevDash CLI with TUI dashboard
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
19
src/ui/components/loading.py
Normal file
19
src/ui/components/loading.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class LoadingSpinner(Static):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__("Loading...", **kwargs)
|
||||
self._spinner_chars = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠫⠽⠘⠰ ⠁⠂⠄⡀⢀⠠⠐⠈"
|
||||
self._index = 0
|
||||
|
||||
async def on_mount(self) -> None:
|
||||
self.update_timer = self.set_interval(0.1, self._spin)
|
||||
|
||||
def _spin(self) -> None:
|
||||
self._index = (self._index + 1) % len(self._spinner_chars)
|
||||
self.update(self._spinner_chars[self._index])
|
||||
|
||||
def on_unmount(self) -> None:
|
||||
if hasattr(self, 'update_timer'):
|
||||
self.update_timer.stop()
|
||||
Reference in New Issue
Block a user