rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Feature request: spinner only #72

Closed lsorber closed 3 years ago

lsorber commented 3 years ago

Would be great to be able to render alive-progress's spinners only, similar to click-spinner's:

with click_spinner.spinner():
    do_something()
    do_something_else()
TheTechRobo commented 3 years ago

Possibly related: #56

In unknown mode, there is currently no way to disable either the unknown bar and/or the spinner. It's very distracting to show two animations in the unknown mode when only one of the animations is enough. If we're able to show only one animation (unknown or spinner), it would look more professional.

Solution in 2.0:

Now there's support for both spinner=None and bar=None, as well as a new config option receipt_text=False. You can just set it to True to print it into the receipt. I preferred a positive logic: when it is True, then Yes it shows, instead of a clear, which when it is True, then No it not shows.

lsorber commented 3 years ago

Would v2.0 also allow you to render the spinner at the current cursor position (i.e. without printing a newline)?

TheTechRobo commented 3 years ago

I'm not sure, you'd have to wait for the maintainer's response.

rsalmei commented 3 years ago

Hey, @lsorber, you can! This was first requested in #40. At least you will, as soon as I release #51...

Thanks @TheTechRobo, I appreciate your help in several tickets! 👍

This should also interest @engineerjoe440! I just implemented support for disabling:

How cool is that!?! 🎉

So in the next 2.0, you will get to do:

https://user-images.githubusercontent.com/6652853/104136439-d59bc780-5374-11eb-856d-869c7acc243e.mov

Or even something like this:

https://user-images.githubusercontent.com/6652853/104136352-47bfdc80-5374-11eb-9707-10895ec7392c.mov

rsalmei commented 3 years ago

Would v2.0 also allow you to render the spinner at the current cursor position (i.e. without printing a newline)?

I think this is not possible "as you say". I cannot read the current cursor position, to reposition it there afterwards. But as I've shown above, you could set a title with any text you want, and draw the spinner besides it. Oh, using the bar.text(), you could also set any text after the spinner!

So you can customize both before and after the spinner, without ever printing a newline 👍

rsalmei commented 3 years ago

Hey, to simulate exactly what click-spinner does, you just:

https://user-images.githubusercontent.com/6652853/104136844-768b8200-5377-11eb-8e1f-859eca6e2a50.mov

rsalmei commented 3 years ago

I couldn't resist 😂

https://user-images.githubusercontent.com/6652853/104136931-fc0f3200-5377-11eb-80a3-a1ff0e91b68b.mov

Remember all the other bells and whistles of alive-progress are active, like hide cursor support, which the other doesn't have...

lsorber commented 3 years ago

Looks great, thank you @rsalmei! (Apologies I didn't search before submitting this issue.)

rsalmei commented 3 years ago

No problem man!