aboutsummaryrefslogtreecommitdiff
path: root/pw_console/py/pw_console/progress_bar/progress_bar_impl.py
diff options
context:
space:
mode:
Diffstat (limited to 'pw_console/py/pw_console/progress_bar/progress_bar_impl.py')
-rw-r--r--pw_console/py/pw_console/progress_bar/progress_bar_impl.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/pw_console/py/pw_console/progress_bar/progress_bar_impl.py b/pw_console/py/pw_console/progress_bar/progress_bar_impl.py
index fc818ede3..08dd62d55 100644
--- a/pw_console/py/pw_console/progress_bar/progress_bar_impl.py
+++ b/pw_console/py/pw_console/progress_bar/progress_bar_impl.py
@@ -59,7 +59,6 @@ class TextIfNotHidden(Text):
) -> AnyFormattedText:
formatted_text = super().format(progress_bar, progress, width)
if hasattr(progress, 'hide_eta') and progress.hide_eta: # type: ignore
-
formatted_text = [('', ' ' * width)]
return formatted_text
@@ -92,13 +91,13 @@ class TimeLeftIfNotHidden(TimeLeft):
class ProgressBarImpl:
"""ProgressBar for rendering in an existing prompt_toolkit application."""
+
def __init__(
self,
title: AnyFormattedText = None,
formatters: Optional[Sequence[Formatter]] = None,
style: Optional[BaseStyle] = None,
) -> None:
-
self.title = title
self.formatters = formatters or create_default_formatters()
self.counters: List[ProgressBarCounter[object]] = []
@@ -121,19 +120,23 @@ class ProgressBarImpl:
progress_controls = [
Window(
- content=_ProgressControl(self, f), # type: ignore
+ content=_ProgressControl(self, f, None), # type: ignore
width=functools.partial(width_for_formatter, f),
- ) for f in self.formatters
+ )
+ for f in self.formatters
]
- self.container = HSplit([
- title_toolbar,
- VSplit(
- progress_controls,
- height=lambda: D(min=len(self.counters),
- max=len(self.counters)),
- ),
- ])
+ self.container = HSplit(
+ [
+ title_toolbar,
+ VSplit(
+ progress_controls,
+ height=lambda: D(
+ min=len(self.counters), max=len(self.counters)
+ ),
+ ),
+ ]
+ )
def __pt_container__(self):
return self.container
@@ -162,6 +165,7 @@ class ProgressBarImpl:
data,
label=label,
remove_when_done=remove_when_done,
- total=total)
+ total=total,
+ )
self.counters.append(counter)
return counter