From 592714279c84ccb5d92132dcd3c21c2a45129756 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Mon, 18 Mar 2024 15:36:17 +0100 Subject: [PATCH] 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 --- subiquitycore/ui/spinner.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subiquitycore/ui/spinner.py b/subiquitycore/ui/spinner.py index f17bb2c3..1446584b 100644 --- a/subiquitycore/ui/spinner.py +++ b/subiquitycore/ui/spinner.py @@ -75,6 +75,8 @@ class Spinner(Text): await asyncio.sleep(self.rate) def start(self): + if self._spin_task is not None: + return if self.debug: log.debug("starting spinner %s", id(self)) self.stop()