annie.pages.pending¶
The pending slot: a box that shows a spinner until its content arrives (UI helper).
Every pane whose content Annie is still producing in the background — a decoding frame, a rendering clip, a video being opened — shows a spinner in its box, so the page never looks idle while work is under way. This module owns that look and its life cycle:
pending()puts a centred spinner in a box. Withkeep=Truethe current content stays visible, dimmed under the spinner (e.g. frames being redrawn for another track).ready()swaps in the finished content;failed()shows an error icon whose tooltip carries the reason.pending_badge()/settle_badge()do the same for a small tag such as#frames.
Each call is a no-op once the box (or its browser tab) is gone, so a background task that finishes after a refresh or reload never has to guard the UI itself.
Attributes¶
Functions¶
|
Create an empty grey media box of a fixed CSS size. |
|
Whether |
|
|
|
Replace the spinner (and any old content) with the finished content. |
|
Replace the spinner with an error icon whose tooltip explains why. |
|
Create a badge slot showing |
|
Replace a pending badge with its final |
|
Run blocking |
Module Contents¶
- annie.pages.pending.MEDIA_BOX = 'position:relative;border-radius:8px;background:#e5e7eb;display:flex;align-items:center;justify-c...¶
Style of the grey, centred media placeholder box (frames, ORIGINAL, render slots).
- annie.pages.pending.CSS = '.annie-pending{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;...¶
Global CSS for the spinner overlay; registered once by the app at start-up.
- annie.pages.pending.media_box(width: int, height: int) nicegui.ui.element[source]¶
Create an empty grey media box of a fixed CSS size.
- annie.pages.pending.is_pending(box: nicegui.ui.element) bool[source]¶
Whether
boxcurrently shows a pending spinner (Falseonce it is gone).
- annie.pages.pending.pending(box: nicegui.ui.element, *, keep: bool = False, size: str = 'md') None[source]¶
Show a centred spinner in
boxuntilready()orfailed().Calling it again on a pending box changes nothing (no second spinner).
- Parameters:
box – The box whose content is being produced.
keep – Keep the current content visible, dimmed under the spinner, instead of emptying the box first.
size – Quasar spinner size (
"xs"…"xl"or a CSS length).
- annie.pages.pending.ready(box: nicegui.ui.element, build: collections.abc.Callable[[], object]) None[source]¶
Replace the spinner (and any old content) with the finished content.
- Parameters:
box – The pending box.
build – Builds the new content; called inside
box.
- annie.pages.pending.failed(box: nicegui.ui.element, reason: str) None[source]¶
Replace the spinner with an error icon whose tooltip explains why.
- Parameters:
box – The pending box.
reason – A short, user-readable cause (shown on hover).
- annie.pages.pending.pending_badge(text: str) nicegui.ui.element[source]¶
Create a badge slot showing
textwith a small spinner, for a value not known yet.- Parameters:
text – The badge text while pending, e.g.
"#frames".- Returns:
The slot to pass to
settle_badge()once the value is known.
- annie.pages.pending.settle_badge(slot: nicegui.ui.element, text: str, color: str = theme.NEUTRAL) None[source]¶
Replace a pending badge with its final
text(no spinner).- Parameters:
slot – The slot returned by
pending_badge().text – The final text, e.g.
"#frames: 120"or"audio: ?".color – The badge colour.
- async annie.pages.pending.while_busy[T](message: str, work: collections.abc.Callable[[], T]) T | None[source]¶
Run blocking
workoff the event loop behind a modal spinner showingmessage.The dialog is persistent (it cannot be dismissed), so the user cannot act in this tab while the work runs, e.g. while a database is being copied.
- Parameters:
message – What is happening, e.g.
"Reading visits.xlsx…".work – The blocking call, run on a worker thread.
- Returns:
What
workreturned;Noneif the app is shutting down.