mbdlyb_ui.functional.clusters
Copyright (c) 2023 - 2026 TNO-ESI All rights reserved.
Classes
Display the CPT import probability table editor. |
|
Hold editable CPT import form state. |
|
Display the cluster create editing page. |
|
Display the cluster detail properties and relations. |
|
Display the cluster import editing page. |
|
Hold editable cluster import form state. |
|
Hold editable cluster form state. |
|
Display the cluster update editing page. |
|
Display the required for table relation table. |
Functions
|
Render the cluster name and optional default hardware and function controls. |
|
Collect conditional probability tables recursively from a cluster. |
|
Ask for confirmation before cloning a cluster and its relations. |
|
Render the CPT upload control and the resulting import table. |
|
Display candidate CPTs and their validation and origin controls. |
|
Download the node's conditional probability table as a spreadsheet. |
|
Package the cluster's conditional probability tables into a ZIP download. |
|
Resolve and validate a spreadsheet against its matching CPT node. |
|
Process each uploaded CPT file and refresh the import table. |
|
Read and process an uploaded CPT spreadsheet. |
|
Read CPT spreadsheets from an uploaded ZIP archive. |
|
Offer eligible parent clusters and move the selected cluster on confirmation. |
|
Render details and actions for the selected functional node. |
Module Contents
- class mbdlyb_ui.functional.clusters.CPTImportPage(cluster_id: str)
Bases:
mbdlyb_ui.functional.base.FunctionalPageDisplay the CPT import probability table editor.
- props: CPTImportProps
- class mbdlyb_ui.functional.clusters.CPTImportProps(cluster: mbdlyb.functional.gdb.GCluster)
Hold editable CPT import form state.
- add_cpt(origin: str, node: mbdlyb.functional.gdb.GCPTEnabledNode, cpt: mbdlyb.cpt.CPT)
Register an imported CPT and set its initial validation and enabled state.
- Parameters:
origin – Source identifier for the imported CPT.
node – CPT-enabled node matched to the imported table.
cpt – Conditional probability table to import.
- cluster: mbdlyb.functional.gdb.GCluster
- cpts: dict[str, tuple[mbdlyb.functional.gdb.GCPTEnabledNode, mbdlyb.cpt.CPT]]
- enabled: dict[str, bool]
- nodes: dict[mbdlyb.functional.gdb.GCPTEnabledNode, list[str]]
- validation_msg: dict[mbdlyb.functional.gdb.GCPTEnabledNode, str | None]
- class mbdlyb_ui.functional.clusters.ClusterCreatePage(parent_cluster_id: str | None = None)
Bases:
mbdlyb_ui.functional.base.FunctionalPageDisplay the cluster create editing page.
- cluster: mbdlyb.functional.gdb.GCluster
- property parent_cluster: mbdlyb.functional.gdb.GCluster | None
Return the selected parent cluster.
- Returns:
Selected parent cluster.
- props: ClusterProps
- class mbdlyb_ui.functional.clusters.ClusterDetailPage(cluster_id: str)
Bases:
mbdlyb_ui.functional.base.FunctionalPageDisplay the cluster detail properties and relations.
- cluster: mbdlyb.functional.gdb.GCluster
- class mbdlyb_ui.functional.clusters.ClusterImportPage(cluster_id: str | None = None)
Bases:
mbdlyb_ui.functional.base.FunctionalPageDisplay the cluster import editing page.
- parent: mbdlyb.gdb.GMBDNet | None
- progress_bar: nicegui.ui.linear_progress
- props: ClusterImportProps
- queue: multiprocessing.Queue
- timer: nicegui.ui.timer
- class mbdlyb_ui.functional.clusters.ClusterImportProps(parent: mbdlyb.gdb.GMBDNet | None = None, capella_architecture: str | None = None, default_fn_tests: bool = False, default_hl_fn_tests: bool = False, default_hw_tests: bool = False, default_ll_hw_tests: bool = False, import_opms: bool = False)
Hold editable cluster import form state.
- capella_architecture = None
- default_fn_tests = False
- default_hl_fn_tests = False
- default_hw_tests = False
- default_ll_hw_tests = False
- files: list[pathlib.Path] = []
- import_opms = False
- parent = None
- class mbdlyb_ui.functional.clusters.ClusterProps(add_hw: bool, add_fn: bool)
Hold editable cluster form state.
- DEFAULT_FUNCTION_NAME = 'MainFunction'
- add_fn
- add_hw
- fn_name: str = ''
- hw_name: str = ''
- class mbdlyb_ui.functional.clusters.ClusterUpdatePage(cluster_id: str)
Bases:
mbdlyb_ui.functional.base.FunctionalPageDisplay the cluster update editing page.
- class mbdlyb_ui.functional.clusters.RequiredForTablePage(cluster_id: str)
Bases:
mbdlyb_ui.functional.base.FunctionalPageDisplay the required for table relation table.
- cluster: mbdlyb.functional.gdb.GCluster
- functions: list[mbdlyb.functional.gdb.GFunction]
- mbdlyb_ui.functional.clusters.cluster_form(cluster: mbdlyb.functional.gdb.GCluster, props: ClusterProps | None = None, parent: mbdlyb.functional.gdb.GCluster | None = None, update: bool = True)
Render the cluster name and optional default hardware and function controls.
- Parameters:
cluster – Cluster whose name is edited in the form.
props – Options for adding default function and hardware to a new cluster.
parent – Optional parent cluster for the new cluster.
update – Whether to edit an existing cluster instead of creating one.
- mbdlyb_ui.functional.clusters.collect_cpts(cluster: mbdlyb.functional.gdb.GCluster, only_required: bool = True) dict[mbdlyb.functional.gdb.GFunctionalNode, mbdlyb.cpt.CPT]
Collect conditional probability tables recursively from a cluster.
- Parameters:
cluster – Cluster to search recursively for eligible CPT nodes.
only_required – Whether to include only nodes needing or defining a CPT.
- Returns:
Mapping of eligible nodes to their conditional probability tables.
- mbdlyb_ui.functional.clusters.copy_cluster(obj) None
Ask for confirmation before cloning a cluster and its relations.
- Parameters:
obj – Cluster whose graph and relations are cloned after confirmation.
- mbdlyb_ui.functional.clusters.cpt_import_form(props: CPTImportProps)
Render the CPT upload control and the resulting import table.
- Parameters:
props – CPT import state bound to the uploader and table.
- mbdlyb_ui.functional.clusters.cpt_import_table(props: CPTImportProps)
Display candidate CPTs and their validation and origin controls.
- Parameters:
props – Uploaded CPT candidates, enabled sources, and validation messages.
- mbdlyb_ui.functional.clusters.download_cpt(node: mbdlyb.functional.gdb.GCPTEnabledNode)
Download the node’s conditional probability table as a spreadsheet.
- Parameters:
node – CPT-enabled node whose table is downloaded.
- mbdlyb_ui.functional.clusters.download_cpts(cluster: mbdlyb.functional.gdb.GCluster, only_required: bool = True)
Package the cluster’s conditional probability tables into a ZIP download.
- Parameters:
cluster – Cluster whose descendant CPTs are packaged for download.
only_required – Whether to include only nodes needing or defining a CPT.
- mbdlyb_ui.functional.clusters.handle_cpt_file_contents(filename: str, contents: io.BytesIO, props: CPTImportProps, origin: str = None)
Resolve and validate a spreadsheet against its matching CPT node.
- Parameters:
filename – Name of the uploaded spreadsheet.
contents – Spreadsheet contents to parse.
props – Import state used to match and validate this CPT.
origin – ZIP member path or uploaded filename identifying the CPT source.
- async mbdlyb_ui.functional.clusters.handle_cpt_upload(e: nicegui.events.MultiUploadEventArguments, props: CPTImportProps)
Process each uploaded CPT file and refresh the import table.
- Parameters:
e – Multi-upload event containing CPT spreadsheets or ZIP archives.
props – Import state to update with uploaded CPTs.
- async mbdlyb_ui.functional.clusters.handle_cpt_xls_file(f: nicegui.ui.upload.FileUpload, props: CPTImportProps)
Read and process an uploaded CPT spreadsheet.
- Parameters:
f – Uploaded file to read.
props – Import settings and uploaded CPT candidates.
- async mbdlyb_ui.functional.clusters.handle_cpt_zip_file(f: nicegui.ui.upload.FileUpload, props: CPTImportProps)
Read CPT spreadsheets from an uploaded ZIP archive.
- Parameters:
f – Uploaded file to read.
props – Import settings and uploaded CPT candidates.
- mbdlyb_ui.functional.clusters.move_cluster(obj) None
Offer eligible parent clusters and move the selected cluster on confirmation.
- Parameters:
obj – Cluster whose parent can be changed.
- mbdlyb_ui.functional.clusters.show_node_details(node: mbdlyb.functional.gdb.GFunctionalNode | mbdlyb.functional.gdb.GCluster | None = None)
Render details and actions for the selected functional node.
- Parameters:
node – Selected tree node whose details are displayed.