Repository navigation
API turboframe.ui.progress
Source: turboframe/ui/progress.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.
The box Turbo Pascal showed while compiling, for anything that takes a while.
ProgressDialog lists what runs (Template: index.tpl), a clock and, at the bottom, what to do: Esc stops the job while it runs; then the verdict ("Success", "Errors") and any key closes it. It also closes by itself after a moment (a success sooner: a quick render only flashes it), since what came out is behind it already (the output, the Messages window).
Under the rows, a bar in Norton Commander's style, in CP437 blocks: █ and ▓ fill a track of ░ while the job says how far it is (progress); a job that cannot say gets a block going back and forth over the track. A job that ended fills the bar, whatever its verdict: the bar says how far the job got, the verdict how it went; only a job stopped with Esc leaves it as it was.
run_with_progress runs a coroutine under the box and returns its result (None when the user stopped it) as soon as it ends: the caller shows what came out behind the box, which stays up with its verdict.
AUTO_CLOSE, AUTO_CLOSE_PROBLEMS, BLOCK, TIME, ProgressDialog, ProgressScreen, bar_text, run_with_progress
2.0
5.0
'▓██▓'
'Time'
class ProgressDialog(TVDialog)
ProgressDialog(title: str, rows: list[tuple[str, str]], *, width: int = 52, stoppable: bool = True)-
progress(fraction: float | None) -> None: How far the job is, 0 to 1 (None: it cannot say). -
set(label: str, value: str) -> None: Change (or add) one row. -
finish(verdict: str, ok: bool, rows: list[tuple[str, str]] | None = None, *, stopped: bool = False) -> None: The job ended (or wasstopped): final rows andverdict("Success"), then any key closes.
class ProgressScreen(ModalScreen)
ProgressScreen(dialog: ProgressDialog, stop: Callable[[], None])The dialog over the desktop: Esc stops the job, then any key (or click) closes.
close() -> None
def bar_text(width: int, fraction: float | None = None, phase: int = 0, *, fill: str | None = None, track: str | None = None) -> TextA bar width cells wide: fraction (0-1) filled, half cells as ▓; None: BLOCK at step phase of its trip there and back. The colours are the palette's progress-fill and progress-track (blue and dark gray on the gray dialogs of the Borland palettes).
async def run_with_progress(app, dialog: ProgressDialog, job: Awaitable[T], verdict: Callable[[T], tuple[str, bool, list[tuple[str, str]]]]) -> T | NoneShow dialog while job runs; verdict(result) gives (word, ok, final rows).
Exceptions of the job close the box and propagate. Call from a worker.
TurboFrame · part of Divengine · GPL-3.0-or-later · report an issue
Tutorial
Examples
The desktop
- The Desktop
- Application Mixins
- Windows and Lists
- Dialogs
- Histories
- Progress
- Themes and Colors
- Glyphs
- Settings and Recent Files
- Command Palette
Editing
Tasks
Languages
Running
Reference
Links