Merge pull request #1667 from willmcgugan/progress-total

new lines fixes
This commit is contained in:
Will McGugan 2021-11-09 16:32:54 +00:00 committed by GitHub
commit a707aedd5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 4 deletions

View File

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [10.13.1] - Unreleased
### Fixed
- Fixed progress speed not updating when total doesn't change
- Fixed superfluous new line in Status https://github.com/willmcgugan/rich/issues/1662
## [10.13.0] - 2021-11-07 ## [10.13.0] - 2021-11-07
### Added ### Added

View File

@ -159,8 +159,6 @@ class Live(JupyterMixin, RenderHook):
# jupyter last refresh must occur after console pop render hook # jupyter last refresh must occur after console pop render hook
# i am not sure why this is needed # i am not sure why this is needed
self.refresh() self.refresh()
if not self.console.is_interactive:
return self.console.print()
def __enter__(self) -> "Live": def __enter__(self) -> "Live":
self.start(refresh=self._renderable is not None) self.start(refresh=self._renderable is not None)

View File

@ -645,6 +645,8 @@ class Progress(JupyterMixin):
def stop(self) -> None: def stop(self) -> None:
"""Stop the progress display.""" """Stop the progress display."""
self.live.stop() self.live.stop()
if not self.console.is_interactive:
self.console.print()
def __enter__(self) -> "Progress": def __enter__(self) -> "Progress":
self.start() self.start()
@ -764,7 +766,7 @@ class Progress(JupyterMixin):
task = self._tasks[task_id] task = self._tasks[task_id]
completed_start = task.completed completed_start = task.completed
if total is not None: if total is not None and total != task.total:
task.total = total task.total = total
task._reset() task._reset()
if advance is not None: if advance is not None:

View File

@ -158,7 +158,7 @@ def test_growing_display_file_console() -> None:
output = console.end_capture() output = console.end_capture()
assert ( assert (
output output
== "Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n\n" == "Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n"
) )