spinner: don't restart the spinner when .start() is called
Previously, when we called spinner.start(), we would automatically call .stop() first to reset it. Unfortunately, after calling stop(), the spinner mutates its visual representation to become invisible using .set_text(""). This is a problem because after disappearing, the spinner does not reappear instantly, which causes visual glitches depending on how often we redraw the screen. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
0987dc5a7a
commit
592714279c
|
@ -75,6 +75,8 @@ class Spinner(Text):
|
||||||
await asyncio.sleep(self.rate)
|
await asyncio.sleep(self.rate)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
if self._spin_task is not None:
|
||||||
|
return
|
||||||
if self.debug:
|
if self.debug:
|
||||||
log.debug("starting spinner %s", id(self))
|
log.debug("starting spinner %s", id(self))
|
||||||
self.stop()
|
self.stop()
|
||||||
|
|
Loading…
Reference in New Issue