mirror of https://github.com/Textualize/rich.git
restore refresh thread check for None
This commit is contained in:
parent
f3a078cc2f
commit
5a3bd44938
|
@ -431,20 +431,21 @@ class Progress:
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
"""Stop the progress display."""
|
"""Stop the progress display."""
|
||||||
assert self._refresh_thread is not None
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
if not self._started:
|
if not self._started:
|
||||||
return
|
return
|
||||||
self._started = False
|
self._started = False
|
||||||
try:
|
try:
|
||||||
if self.auto_refresh:
|
if self.auto_refresh and self._refresh_thread is not None:
|
||||||
self._refresh_thread.stop()
|
self._refresh_thread.stop()
|
||||||
self.refresh()
|
self.refresh()
|
||||||
if self.console.is_terminal:
|
if self.console.is_terminal:
|
||||||
self.console.line()
|
self.console.line()
|
||||||
finally:
|
finally:
|
||||||
self.console.show_cursor(True)
|
self.console.show_cursor(True)
|
||||||
|
if self._refresh_thread is not None:
|
||||||
self._refresh_thread.join()
|
self._refresh_thread.join()
|
||||||
|
self._refresh_thread = None
|
||||||
|
|
||||||
def __enter__(self) -> "Progress":
|
def __enter__(self) -> "Progress":
|
||||||
self.start()
|
self.start()
|
||||||
|
|
Loading…
Reference in New Issue