mbdlyb_ui.base

Copyright (c) 2026 TNO-ESI All rights reserved.

Classes

Button

Hold presentation and action options for a model-aware UI button.

ConditionalButton

Display a button only when its condition accepts the current element.

Page

Render a model-backed page with shared navigation, controls, and layout.

Table

Render a titled table of model elements with optional actions.

TableColumn

Describe a table column backed by an element attribute or callable.

TableMultiColumn

Render a collection-valued field as multiple cells in one column.

Module Contents

class mbdlyb_ui.base.Button

Hold presentation and action options for a model-aware UI button.

show(obj: mbdlyb.gdb.GMBDElement | None = None, hide_label=False, btn_props: str | None = None, tooltip_classes: str | None = None) → nicegui.ui.button

Render a button with evaluated labels, colors, and click handler.

Parameters:
  • obj – Element used to evaluate dynamic button options.

  • hide_label – Whether to display only the icon.

  • btn_props – Additional NiceGUI button properties.

  • tooltip_classes – CSS classes for the tooltip.

Returns:

The created NiceGUI button.

show_icon(obj: mbdlyb.gdb.GMBDElement = None, btn_props: str = None, tooltip_classes: str = None)

Render this action as a clickable icon.

Parameters:
  • obj – Element used to evaluate dynamic icon options.

  • btn_props – Additional NiceGUI icon properties.

  • tooltip_classes – CSS classes for the tooltip.

color: str | Callable[[mbdlyb.gdb.GMBDElement], str] | None = None
enabled_from: tuple[Any, str, Any] | None = None
handler: str | Callable[[], Any] | Callable[[mbdlyb.gdb.GMBDElement], Any] | None = None
icon: str | Callable[[mbdlyb.gdb.GMBDElement], str] | None = None
label: str | Callable[[mbdlyb.gdb.GMBDElement], str] | None = None
tooltip: str | Callable[[mbdlyb.gdb.GMBDElement], str] | None = None
class mbdlyb_ui.base.ConditionalButton

Bases: Button

Display a button only when its condition accepts the current element.

show(obj: mbdlyb.gdb.GMBDElement = None, hide_label=False, btn_props: str = None, tooltip_classes: str = None)

Render the button when its condition passes.

Parameters:
  • obj – Element tested against the condition.

  • hide_label – Whether to omit button text.

  • btn_props – Additional NiceGUI button properties.

  • tooltip_classes – CSS classes for the tooltip.

show_icon(obj: mbdlyb.gdb.GMBDElement = None, btn_props: str = None, tooltip_classes: str = None)

Render the clickable icon when its condition passes.

Parameters:
  • obj – Element tested against the condition.

  • btn_props – Additional NiceGUI icon properties.

  • tooltip_classes – CSS classes for the tooltip.

condition: Callable[[mbdlyb.gdb.GMBDElement], bool] | None = None
class mbdlyb_ui.base.Page(title: str | None = None, element: mbdlyb.gdb.GMBDElement | None = None, buttons: list[Button] | None = None, header_text: str = '', hide_breadcrumbs: bool = False, hide_menu_tree: bool = False, settings: Callable[[nicegui.ui.dialog], None] | None = None, status: mbdlyb_ui.utils.Status | None = None)

Render a model-backed page with shared navigation, controls, and layout.

static get_mode() → str

Return the mode currently stored in NiceGUI’s general storage.

Returns:

The selected application mode.

Raises:

KeyError – If no mode has been stored.

show()

Render the shared page layout and subclass-specific content.

property element: mbdlyb.gdb.GMBDElement | None

Return the model element associated with this page.

Returns:

The selected element, or None if the page has no element.

property has_modes: bool

Report whether the app offers more than one mode.

Returns:

True when the mode selector is needed.

class mbdlyb_ui.base.Table

Render a titled table of model elements with optional actions.

show()

Render table headings, rows, and configured action buttons.

columns: list[TableColumn]
obj: object | None = None
row_actions: list[Button] | None = None
rows: Iterable
table_actions: list[Button] | None = None
title: str
class mbdlyb_ui.base.TableColumn

Describe a table column backed by an element attribute or callable.

show(obj: mbdlyb.gdb.GMBDElement, classes: str | None = None, tooltip_classes: str | None = None)

Render a cell for an element, optionally with a link and tooltip.

Parameters:
  • obj – Element providing the cell value.

  • classes – CSS classes applied to the cell row.

  • tooltip_classes – CSS classes applied to its tooltip.

header: str
tooltip: str | Callable[[mbdlyb.gdb.GMBDElement], str] | None = None
url: Callable[[mbdlyb.gdb.GMBDElement], str] | None = None
value: str | Callable[[mbdlyb.gdb.GMBDElement], str]
class mbdlyb_ui.base.TableMultiColumn

Bases: TableColumn

Render a collection-valued field as multiple cells in one column.

show(obj: mbdlyb.gdb.GMBDElement, classes: str | None = None, tooltip_classes: str | None = None)

Render each related element, optionally sorted, with separators.

Parameters:
  • obj – Element providing the related collection.

  • classes – CSS classes applied to the row.

  • tooltip_classes – CSS classes passed to the child column renderer.

list_attribute: str = None
order_by: str | None = None
separator: str = '\t|'