1from types
import TracebackType
2from typing
import Optional, Type
4from .console
import Console, RenderableType
5from .jupyter
import JupyterMixin
7from .spinner
import Spinner
8from .style
import StyleType
12 """Displays a status indicator with a 'spinner' animation.
15 status (RenderableType): A status renderable (str or Text typically).
16 console (Console, optional): Console instance to use, or None for global console. Defaults to None.
17 spinner (str, optional): Name of spinner animation (see python -m rich.spinner). Defaults to "dots".
18 spinner_style (StyleType, optional): Style of spinner. Defaults to "status.spinner".
19 speed (float, optional): Speed factor for spinner animation. Defaults to 1.0.
20 refresh_per_second (float, optional): Number of refreshes per second. Defaults to 12.5.
25 status: RenderableType,
27 console: Optional[Console] =
None,
28 spinner: str =
"dots",
29 spinner_style: StyleType =
"status.spinner",
31 refresh_per_second: float = 12.5,
40 refresh_per_second=refresh_per_second,
50 """Get the Console used by the Status objects."""
51 return self.
_live.console
55 status: Optional[RenderableType] =
None,
57 spinner: Optional[str] =
None,
58 spinner_style: Optional[StyleType] =
None,
59 speed: Optional[float] =
None,
64 status (Optional[RenderableType], optional): New status renderable or None for no change. Defaults to None.
65 spinner (Optional[str], optional): New spinner or None for no change. Defaults to None.
66 spinner_style (Optional[StyleType], optional): New spinner style or None for no change. Defaults to None.
67 speed (Optional[float], optional): Speed factor for spinner animation or None for no change. Defaults to None.
69 if status
is not None:
71 if spinner_style
is not None:
75 if spinner
is not None:
86 """Start the status animation."""
90 """Stop the spinner animation."""
102 exc_type: Optional[Type[BaseException]],
103 exc_val: Optional[BaseException],
104 exc_tb: Optional[TracebackType],
109if __name__ ==
"__main__":
111 from time
import sleep
113 from .console
import Console
116 with console.status(
"[magenta]Covid detector booting up")
as status:
124 console.log(
"Found 10,000,000,000 copies of Covid32.exe")
127 status=
"[bold red]Moving Covid32.exe to Trash",
128 spinner=
"bouncingBall",
129 spinner_style=
"yellow",
None __exit__(self, Optional[Type[BaseException]] exc_type, Optional[BaseException] exc_val, Optional[TracebackType] exc_tb)
__init__(self, RenderableType status, *Optional[Console] console=None, str spinner="dots", StyleType spinner_style="status.spinner", float speed=1.0, float refresh_per_second=12.5)
None update(self, Optional[RenderableType] status=None, *Optional[str] spinner=None, Optional[StyleType] spinner_style=None, Optional[float] speed=None)
RenderableType __rich__(self)