annie.pages.tabs

Lazily built tab panels: a tab’s content is built the first time it is opened (UI helper).

Building every tab on each page load used to cost the full Browse first page, the Annotator task, the Dataset config scan and more, before the user had even looked. LazyTabs creates the empty panels up front and fills each one on its first visit.

Classes

LazyTabs

Tab panels whose content is built on first open.

Module Contents

class annie.pages.tabs.LazyTabs(builders: collections.abc.Mapping[str, collections.abc.Callable[[], None]])[source]

Tab panels whose content is built on first open.

Must be created inside the page (a NiceGUI client context), under ui.tab_panels.

Parameters:

builders – Tab name → function that builds the tab’s content (called once, inside its panel), in display order.

open(name: str) → bool[source]

Make sure tab name is built.

Returns:

True if it was built just now (its content is fresh), False if it had been built before (or name is not a lazy tab).

is_built(name: str) → bool[source]

Whether tab name has been built in this page.