annie.pages.visibility¶
Which tab a browser shows, so key handlers and pollers run only while theirs is visible.
NiceGUI keeps every tab panel alive once built, and a ui.keyboard listens on the whole
document. Without this, the Annotator’s keys (Space, the arrows, digits) still acted while
the reviewer typed or scrolled on Browse, and the 10 Hz playhead poll kept talking to the
browser from a hidden tab.
Elements with an active flag (ui.keyboard, ui.timer) are registered with
only_while_shown(); show() (called on every tab switch) turns them on for the
visible tab and off for the others.
Functions¶
|
The tab the current browser tab shows ( |
|
Record that the current browser tab now shows |
|
Keep |
Module Contents¶
- annie.pages.visibility.shown_tab() str | None[source]¶
The tab the current browser tab shows (
Nonebefore the firstshow()).
- annie.pages.visibility.show(tab: str) None[source]¶
Record that the current browser tab now shows
tab; switch members on or off.
- annie.pages.visibility.only_while_shown[T: _Switchable](element: T, tab: str) T[source]¶
Keep
elementactive only whiletabis the shown tab of its browser tab.- Parameters:
element – A
ui.keyboardorui.timerbuilt insidetab.tab – The tab name it belongs to (e.g.
"annotator").
- Returns:
The element, already switched to match the tab shown now.