Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
ParseGUI Class Reference

Static Public Member Functions

Widget parse_widget (Dict[str, Any] data)
GUI parse_gui (Dict[str, Any] data)
bool validate_gui_spec (str spec_path)

Detailed Description

Static parsing + validation helpers for GUI JSON specifications.

Responsibilities:
  • Validate raw JSON against the formal schema.
  • Recursively construct typed dataclass instances (`Window`, `Widget`, `Metadata`).
  • Enforce strict filtering — only schema-declared fields are retained.

This abstraction decouples JSON I/O from UI logic and ensures deterministic
parsing independent of GUI backend framework choice.

Member Function Documentation

◆ parse_gui()

GUI parse_gui ( Dict[str, Any] data)
static
Validate and convert a top-level JSON spec into a `GUI` dataclass.

Pipeline:
    1. JSON Schema validation (raises on violation).
    2. Recursive widget tree construction.
    3. Metadata extraction.

Returns:
    Fully-typed `GUI` representation of the specification.

◆ parse_widget()

Widget parse_widget ( Dict[str, Any] data)
static
Construct a `Widget` dataclass from a validated widget dictionary.

Features:
  • Recursively parses `children` entries.
  • Filters out unknown keys (schema-driven strictness).
  • Maintains forward-compatibility if JSON contains UI editor noise.

Returns a clean `Widget` tree suitable for layout engines and code-gen.

◆ validate_gui_spec()

bool validate_gui_spec ( str spec_path)
static
Validate a GUI JSON file against the schema on disk.

Prints detailed human-readable error messages including JSON path context.
Returns True on success, False on validation failure or IO error.

Intended for CLI usage and pre-generation sanity checks.