|
oct
|
Public Member Functions | |
| None | __init__ (self, *, TextIO|None stream=None, bool quiet=False) |
| None | render (self, list[str] lines, *, int footer_line=-1, int tasks_total=0) |
| None | update_line (self, int index, str text) |
| None | set_task (self, str name) |
| None | complete_task (self) |
| None | finish (self) |
Protected Member Functions | |
| None | _timer_loop (self) |
| None | _update_footer (self) |
Protected Attributes | |
| _stream = stream or sys.stdout | |
| _quiet = quiet | |
| _is_tty = hasattr(self._stream, "isatty") and self._stream.isatty() | |
| _lock = threading.Lock() | |
| list | _lines = [] |
| int | _line_count = 0 |
| int | _footer_line = -1 |
| str|None | _task_name = None |
| float | _task_start = 0.0 |
| float | _overall_start = 0.0 |
| int | _tasks_done = 0 |
| int | _tasks_total = 0 |
| _stop_event = threading.Event() | |
| threading.Thread|None | _timer_thread = None |
Fixed-size terminal display with in-place line updates and live timer. Prints a full template on render(), then overwrites individual lines via ANSI cursor movement as data becomes available. A background daemon thread refreshes the footer line every second so elapsed-time counters stay live. On non-TTY streams the template is NOT printed during render(); instead, update_line() silently accumulates changes and finish() prints the final state in one shot - clean output for CI and pipes.
Definition at line 205 of file progress.py.
| None progress.Dashboard.__init__ | ( | self, | |
| * | , | ||
| TextIO | None | stream = None, | ||
| bool | quiet = False ) |
Definition at line 217 of file progress.py.
|
protected |
Definition at line 305 of file progress.py.
|
protected |
Definition at line 311 of file progress.py.
| None progress.Dashboard.complete_task | ( | self | ) |
Increment done counter and clear the current task name.
Definition at line 279 of file progress.py.
| None progress.Dashboard.finish | ( | self | ) |
Stop the timer thread and render final state.
Definition at line 285 of file progress.py.
| None progress.Dashboard.render | ( | self, | |
| list[str] | lines, | ||
| * | , | ||
| int | footer_line = -1, | ||
| int | tasks_total = 0 ) |
Print all lines. *footer_line* is the index auto-updated by the background timer (default: third-from-last).
Definition at line 238 of file progress.py.
| None progress.Dashboard.set_task | ( | self, | |
| str | name ) |
Set current task name and reset the per-task elapsed timer.
Definition at line 272 of file progress.py.
| None progress.Dashboard.update_line | ( | self, | |
| int | index, | ||
| str | text ) |
Replace the line at *index* with *text*.
Definition at line 259 of file progress.py.
|
protected |
Definition at line 229 of file progress.py.
|
protected |
Definition at line 225 of file progress.py.
|
protected |
Definition at line 228 of file progress.py.
|
protected |
Definition at line 227 of file progress.py.
|
protected |
Definition at line 226 of file progress.py.
|
protected |
Definition at line 232 of file progress.py.
|
protected |
Definition at line 224 of file progress.py.
|
protected |
Definition at line 235 of file progress.py.
|
protected |
Definition at line 223 of file progress.py.
|
protected |
Definition at line 230 of file progress.py.
|
protected |
Definition at line 231 of file progress.py.
|
protected |
Definition at line 233 of file progress.py.
|
protected |
Definition at line 234 of file progress.py.
|
protected |
Definition at line 236 of file progress.py.