annie.pages.utils¶
Shared UI helpers used by multiple page modules (UI).
Attributes¶
apply the value 300 ms after the last keystroke. |
Functions¶
|
Idle-revert delay for an embedded rendered clip. |
|
Toast from a handler that tore down the slot it was invoked in. |
|
Swap an embedded clip back to its placeholder once it has sat idle. |
Module Contents¶
- annie.pages.utils.DEBOUNCE = 'debounce=300'¶
apply the value 300 ms after the last keystroke.
- Type:
Quasar prop for typed filter inputs
- annie.pages.utils.render_embed_ttl() float[source]¶
Idle-revert delay for an embedded rendered clip.
Capped at the temp-dir sweep TTL so a rendered clip’s
ui.videoalways reverts to its placeholder no later than the periodic sweep deletes the underlying file — the element never points at a clip that has been reclaimed from disk.
- annie.pages.utils.notify_detached(client: nicegui.Client, message: str, *, color: str) None[source]¶
Toast from a handler that tore down the slot it was invoked in.
ui.notifyresolves its client through the slot the handler runs in, which NiceGUI takes from the sender’s parent element. A handler that deletes its own row — or refreshes the container holding its button — drops the last reference to that parent, so a laterui.notifydies with “the parent element this slot belongs to has been deleted”.Re-entering
clientlands innicegui.Client.content, which outlives any refresh, so the toast survives the teardown that caused it.- Parameters:
client – The client captured before the teardown (
context.client).message – The toast text.
color – The toast colour.
- annie.pages.utils.unembed_after_idle(box: nicegui.ui.element, restore: collections.abc.Callable[[], None], *, ttl: float | None = None) None[source]¶
Swap an embedded clip back to its placeholder once it has sat idle.
An embedded
ui.videokeeps its clip buffered in the browser tab (and its element alive server-side) for as long as the row is on the page. A reviewer who plays a dozen clips while scrolling never gets that memory back. So each embed schedules its own reversal: afterttlseconds,restorerebuilds the cheap placeholder and the clip is dropped.The wait runs via
annie.pages.lazy.schedule(), so a row refreshed away mid-wait has no parent slot to be deleted;restoreis skipped when the box no longer exists.- Parameters:
box – The container holding the embedded clip.
restore – Rebuilds the placeholder content inside
box. Must clear it.ttl – Idle seconds before reverting. Defaults to
annie.app_state.UiSettings.embed_ttl_seconds; rendered clips passrender_embed_ttl()so they never outlive the temp-dir sweep.