Воркед
This commit is contained in:
1 parent
ac32c55ab9
commit
ee94d8e529
1138 files changed
+55771
-77901
No files matched your search
@@ -11,6 +11,18 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class Spinner:
|
||||
"""A spinner animation.
|
||||
|
||||
Args:
|
||||
name (str): Name of spinner (run python -m rich.spinner).
|
||||
text (RenderableType, optional): A renderable to display at the right of the spinner (str or Text typically). Defaults to "".
|
||||
style (StyleType, optional): Style for spinner animation. Defaults to None.
|
||||
speed (float, optional): Speed factor for animation. Defaults to 1.0.
|
||||
|
||||
Raises:
|
||||
KeyError: If name isn't one of the supported spinner animations.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
@@ -19,17 +31,6 @@ class Spinner:
|
||||
style: Optional["StyleType"] = None,
|
||||
speed: float = 1.0,
|
||||
) -> None:
|
||||
"""A spinner animation.
|
||||
|
||||
Args:
|
||||
name (str): Name of spinner (run python -m rich.spinner).
|
||||
text (RenderableType, optional): A renderable to display at the right of the spinner (str or Text typically). Defaults to "".
|
||||
style (StyleType, optional): Style for spinner animation. Defaults to None.
|
||||
speed (float, optional): Speed factor for animation. Defaults to 1.0.
|
||||
|
||||
Raises:
|
||||
KeyError: If name isn't one of the supported spinner animations.
|
||||
"""
|
||||
try:
|
||||
spinner = SPINNERS[name]
|
||||
except KeyError:
|
||||
@@ -37,6 +38,7 @@ class Spinner:
|
||||
self.text: "Union[RenderableType, Text]" = (
|
||||
Text.from_markup(text) if isinstance(text, str) else text
|
||||
)
|
||||
self.name = name
|
||||
self.frames = cast(List[str], spinner["frames"])[:]
|
||||
self.interval = cast(float, spinner["interval"])
|
||||
self.start_time: Optional[float] = None
|
||||
|
||||
Reference in new issue
Block a user