Compact ActivityIndicator animation
Currently the loading animation is a few characters long, [ = ]...
What do you think about a providing a way to have a more compact form like:
https://github.com/user-attachments/assets/6c872934-7916-45df-a41b-d2784f8cd070
The implementation from the video looks like this:
class ActivityIndicator:
width = 10 # type: int
interval = 100 # type: int
_frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
def render(self, ticks: int) -> str:
frame = self._frames[ticks % len(self._frames)]
return "{} {}".format(
frame,
self.label
)
Imo the ActivityIndicator class should take a frames: list[str] parameter that the render method will cycle through. We can then provide helper functions or constants with such frames that a user can choose from or create their own.
The current behavior could then for example be represented by a method that takes a width: int parameter and generates the respective frames .
Unsure if we'd also want to make the position of the label configurable alongside it.