testerkit 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- testerkit/__init__.py +68 -0
- testerkit/_docs/_assets/operator-ui/channels/table.png +0 -0
- testerkit/_docs/_assets/operator-ui/dashboard/runs.png +0 -0
- testerkit/_docs/_assets/operator-ui/dashboard/stations.png +0 -0
- testerkit/_docs/_assets/operator-ui/events/filters.png +0 -0
- testerkit/_docs/_assets/operator-ui/events/table.png +0 -0
- testerkit/_docs/_assets/operator-ui/explore/chart.png +0 -0
- testerkit/_docs/_assets/operator-ui/explore/filters.png +0 -0
- testerkit/_docs/_assets/operator-ui/explore/plot-controls.png +0 -0
- testerkit/_docs/_assets/operator-ui/files/table.png +0 -0
- testerkit/_docs/_assets/operator-ui/launch/form.png +0 -0
- testerkit/_docs/_assets/operator-ui/metrics/filters.png +0 -0
- testerkit/_docs/_assets/operator-ui/metrics/pareto.png +0 -0
- testerkit/_docs/_assets/operator-ui/metrics/ppk.png +0 -0
- testerkit/_docs/_assets/operator-ui/metrics/yield.png +0 -0
- testerkit/_docs/_assets/operator-ui/results/detail-header.png +0 -0
- testerkit/_docs/_assets/operator-ui/results/detail-measurements.png +0 -0
- testerkit/_docs/_assets/operator-ui/results/detail-overview.png +0 -0
- testerkit/_docs/_assets/operator-ui/results/detail-steps.png +0 -0
- testerkit/_docs/_assets/operator-ui/results/stats.png +0 -0
- testerkit/_docs/_assets/operator-ui/results/table.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/designer.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/docs.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/fixtures.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/instruments.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/parts.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/profiles.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/stations.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/tests.png +0 -0
- testerkit/_docs/_assets/operator-ui/tour/uuts.png +0 -0
- testerkit/_docs/concepts/configuration/capabilities.md +447 -0
- testerkit/_docs/concepts/configuration/fixtures.md +335 -0
- testerkit/_docs/concepts/configuration/index.md +14 -0
- testerkit/_docs/concepts/configuration/parts.md +276 -0
- testerkit/_docs/concepts/configuration/stations.md +214 -0
- testerkit/_docs/concepts/data/data-stores.md +199 -0
- testerkit/_docs/concepts/data/event-log.md +185 -0
- testerkit/_docs/concepts/data/event-sourcing.md +76 -0
- testerkit/_docs/concepts/data/flight-streaming.md +58 -0
- testerkit/_docs/concepts/data/index.md +17 -0
- testerkit/_docs/concepts/data/sessions.md +78 -0
- testerkit/_docs/concepts/data/three-verbs.md +260 -0
- testerkit/_docs/concepts/execution/index.md +13 -0
- testerkit/_docs/concepts/execution/outcomes.md +199 -0
- testerkit/_docs/concepts/execution/step-hierarchy.md +170 -0
- testerkit/_docs/concepts/execution/step-manifest.md +115 -0
- testerkit/_docs/concepts/index.md +40 -0
- testerkit/_docs/concepts/overview/ai-integration.md +57 -0
- testerkit/_docs/concepts/overview/architecture.md +357 -0
- testerkit/_docs/concepts/overview/index.md +14 -0
- testerkit/_docs/concepts/overview/platform-vs-framework.md +147 -0
- testerkit/_docs/concepts/overview/pytest.md +53 -0
- testerkit/_docs/concepts/overview/tiers.md +46 -0
- testerkit/_docs/how-to/catalog/datasheet-to-test.md +169 -0
- testerkit/_docs/how-to/catalog/index.md +11 -0
- testerkit/_docs/how-to/configuration/configuring-stations.md +364 -0
- testerkit/_docs/how-to/configuration/custom-drivers.md +484 -0
- testerkit/_docs/how-to/configuration/index.md +13 -0
- testerkit/_docs/how-to/configuration/mock-mode.md +342 -0
- testerkit/_docs/how-to/data/benchmarking.md +120 -0
- testerkit/_docs/how-to/data/capture-an-artifact.md +84 -0
- testerkit/_docs/how-to/data/capture-waveform.md +110 -0
- testerkit/_docs/how-to/data/choosing-a-channel-verb.md +108 -0
- testerkit/_docs/how-to/data/compare-runs.md +120 -0
- testerkit/_docs/how-to/data/export-results.md +104 -0
- testerkit/_docs/how-to/data/find-flaky-tests.md +108 -0
- testerkit/_docs/how-to/data/grafana-dashboards.md +148 -0
- testerkit/_docs/how-to/data/index.md +23 -0
- testerkit/_docs/how-to/data/mcp-debug-failures.md +125 -0
- testerkit/_docs/how-to/data/mcp-query-runs.md +120 -0
- testerkit/_docs/how-to/data/querying-channels.md +117 -0
- testerkit/_docs/how-to/data/querying-events.md +85 -0
- testerkit/_docs/how-to/data/stream-live-channel.md +134 -0
- testerkit/_docs/how-to/execution/custom-operator-ui.md +136 -0
- testerkit/_docs/how-to/execution/index.md +21 -0
- testerkit/_docs/how-to/execution/limits.md +193 -0
- testerkit/_docs/how-to/execution/managing-sessions.md +100 -0
- testerkit/_docs/how-to/execution/multi-uut-testing.md +211 -0
- testerkit/_docs/how-to/execution/operator-prompts.md +151 -0
- testerkit/_docs/how-to/execution/profiles.md +304 -0
- testerkit/_docs/how-to/execution/spec-driven-testing.md +169 -0
- testerkit/_docs/how-to/execution/test-context.md +212 -0
- testerkit/_docs/how-to/execution/traceability.md +252 -0
- testerkit/_docs/how-to/execution/vector-expansion.md +394 -0
- testerkit/_docs/how-to/execution/writing-tests.md +363 -0
- testerkit/_docs/how-to/index.md +59 -0
- testerkit/_docs/how-to/overview/index.md +11 -0
- testerkit/_docs/how-to/overview/mcp-integration.md +168 -0
- testerkit/_docs/how-to/overview/operator-ui-tour.md +234 -0
- testerkit/_docs/integration/data/grafana.md +162 -0
- testerkit/_docs/integration/data/index.md +15 -0
- testerkit/_docs/integration/data/lakehouse-import.md +226 -0
- testerkit/_docs/integration/data/logging.md +131 -0
- testerkit/_docs/integration/data/results-api.md +51 -0
- testerkit/_docs/integration/index.md +20 -0
- testerkit/_docs/integration/runtime/harness.md +281 -0
- testerkit/_docs/integration/runtime/index.md +13 -0
- testerkit/_docs/integration/runtime/instruments.md +284 -0
- testerkit/_docs/integration/runtime/pytest-existing.md +315 -0
- testerkit/_docs/reference/catalog/cookbook.md +389 -0
- testerkit/_docs/reference/catalog/index.md +11 -0
- testerkit/_docs/reference/catalog/schema.md +375 -0
- testerkit/_docs/reference/cli.md +660 -0
- testerkit/_docs/reference/configuration.md +406 -0
- testerkit/_docs/reference/data/channels-schema.md +145 -0
- testerkit/_docs/reference/data/event-types.md +554 -0
- testerkit/_docs/reference/data/events-schema.md +120 -0
- testerkit/_docs/reference/data/files-schema.md +141 -0
- testerkit/_docs/reference/data/index.md +18 -0
- testerkit/_docs/reference/data/models.md +2229 -0
- testerkit/_docs/reference/data/outputs.md +82 -0
- testerkit/_docs/reference/data/parquet-schema.md +529 -0
- testerkit/_docs/reference/data/performance-limits.md +224 -0
- testerkit/_docs/reference/data/query-api.md +247 -0
- testerkit/_docs/reference/index.md +69 -0
- testerkit/_docs/reference/operator-ui/channels/detail.md +82 -0
- testerkit/_docs/reference/operator-ui/channels/list.md +70 -0
- testerkit/_docs/reference/operator-ui/dashboard.md +87 -0
- testerkit/_docs/reference/operator-ui/designer.md +167 -0
- testerkit/_docs/reference/operator-ui/events.md +89 -0
- testerkit/_docs/reference/operator-ui/files.md +74 -0
- testerkit/_docs/reference/operator-ui/fixtures.md +100 -0
- testerkit/_docs/reference/operator-ui/instruments.md +126 -0
- testerkit/_docs/reference/operator-ui/launch.md +79 -0
- testerkit/_docs/reference/operator-ui/live.md +102 -0
- testerkit/_docs/reference/operator-ui/measurements.md +159 -0
- testerkit/_docs/reference/operator-ui/metrics.md +217 -0
- testerkit/_docs/reference/operator-ui/parts.md +98 -0
- testerkit/_docs/reference/operator-ui/profiles.md +103 -0
- testerkit/_docs/reference/operator-ui/results/detail.md +214 -0
- testerkit/_docs/reference/operator-ui/results/list.md +106 -0
- testerkit/_docs/reference/operator-ui/stations.md +98 -0
- testerkit/_docs/reference/operator-ui/tests.md +173 -0
- testerkit/_docs/reference/operator-ui/uuts.md +67 -0
- testerkit/_docs/reference/overview/index.md +11 -0
- testerkit/_docs/reference/overview/pytest-native.md +142 -0
- testerkit/_docs/reference/overview/skills.md +177 -0
- testerkit/_docs/reference/pytest/fixtures.md +342 -0
- testerkit/_docs/reference/pytest/index.md +12 -0
- testerkit/_docs/reference/pytest/markers.md +257 -0
- testerkit/_docs/reference/runtime/api.md +246 -0
- testerkit/_docs/reference/runtime/client.md +280 -0
- testerkit/_docs/reference/runtime/connect.md +140 -0
- testerkit/_docs/reference/runtime/index.md +13 -0
- testerkit/_docs/tutorial/01-first-test.md +113 -0
- testerkit/_docs/tutorial/02-mock-instruments.md +88 -0
- testerkit/_docs/tutorial/03-fixtures.md +169 -0
- testerkit/_docs/tutorial/04-limits.md +139 -0
- testerkit/_docs/tutorial/05-configuration.md +194 -0
- testerkit/_docs/tutorial/06-specifications.md +273 -0
- testerkit/_docs/tutorial/07-real-instruments.md +245 -0
- testerkit/_docs/tutorial/08-capabilities.md +223 -0
- testerkit/_docs/tutorial/09-production.md +374 -0
- testerkit/_docs/tutorial/10-live-monitoring.md +156 -0
- testerkit/_docs/tutorial/11-waveforms-and-evidence.md +169 -0
- testerkit/_docs/tutorial/12-continuous-monitoring.md +145 -0
- testerkit/_docs/tutorial/13-parallel-testing.md +233 -0
- testerkit/_docs/tutorial/index.md +61 -0
- testerkit/_docs/tutorial/quickstart.md +282 -0
- testerkit/analysis/__init__.py +9 -0
- testerkit/analysis/_common.py +24 -0
- testerkit/analysis/measurement_facets.py +524 -0
- testerkit/analysis/measurements_query.py +1458 -0
- testerkit/analysis/metrics.py +389 -0
- testerkit/analysis/runs_query.py +434 -0
- testerkit/analysis/steps_query.py +413 -0
- testerkit/api/__init__.py +6 -0
- testerkit/api/_mime.py +71 -0
- testerkit/api/app.py +1171 -0
- testerkit/api/dialogs/__init__.py +36 -0
- testerkit/api/dialogs/manager.py +617 -0
- testerkit/api/dialogs/models.py +79 -0
- testerkit/api/models.py +80 -0
- testerkit/api/responses.py +205 -0
- testerkit/api/runner.py +222 -0
- testerkit/api/schemas.py +311 -0
- testerkit/benchmark/__init__.py +34 -0
- testerkit/benchmark/concurrency.py +248 -0
- testerkit/benchmark/core.py +232 -0
- testerkit/benchmark/runner.py +628 -0
- testerkit/benchmark/scenario.py +313 -0
- testerkit/benchmark/system.py +191 -0
- testerkit/benchmark/workloads.py +507 -0
- testerkit/catalog/__init__.py +6 -0
- testerkit/catalog/generic/generic_dmm.yaml +61 -0
- testerkit/catalog/generic/generic_eload.yaml +31 -0
- testerkit/catalog/generic/generic_fgen.yaml +56 -0
- testerkit/catalog/generic/generic_oscilloscope.yaml +45 -0
- testerkit/catalog/generic/generic_psu.yaml +77 -0
- testerkit/catalog/generic/generic_smu.yaml +73 -0
- testerkit/channels.py +538 -0
- testerkit/cli/__init__.py +32 -0
- testerkit/cli/_common.py +113 -0
- testerkit/cli/_time.py +179 -0
- testerkit/cli/benchmark_cmd.py +56 -0
- testerkit/cli/catalog_cmd.py +39 -0
- testerkit/cli/daemon.py +157 -0
- testerkit/cli/data_cmd.py +1040 -0
- testerkit/cli/discover_cmd.py +94 -0
- testerkit/cli/docs_cmd.py +100 -0
- testerkit/cli/instrument.py +172 -0
- testerkit/cli/mcp_cmd.py +37 -0
- testerkit/cli/metrics.py +366 -0
- testerkit/cli/project.py +312 -0
- testerkit/cli/root.py +14 -0
- testerkit/cli/runs.py +412 -0
- testerkit/cli/schema_cmd.py +87 -0
- testerkit/cli/serve_cmd.py +50 -0
- testerkit/cli/setup_cmd.py +604 -0
- testerkit/cli/station.py +294 -0
- testerkit/cli/validate.py +112 -0
- testerkit/client.py +463 -0
- testerkit/connect.py +635 -0
- testerkit/data/__init__.py +8 -0
- testerkit/data/_accumulator_pool.py +455 -0
- testerkit/data/_atomic.py +59 -0
- testerkit/data/_collection_indices.py +67 -0
- testerkit/data/_daemon_lifecycle.py +535 -0
- testerkit/data/_duckdb_daemon.py +695 -0
- testerkit/data/_duckdb_flight_server.py +813 -0
- testerkit/data/_event_filters.py +15 -0
- testerkit/data/_event_reader.py +101 -0
- testerkit/data/_flight_errors.py +199 -0
- testerkit/data/_flight_query.py +202 -0
- testerkit/data/_flight_retry.py +148 -0
- testerkit/data/_flight_subscribe.py +67 -0
- testerkit/data/_index_epoch.py +342 -0
- testerkit/data/_ipc_writer.py +185 -0
- testerkit/data/_json_safe.py +63 -0
- testerkit/data/_process.py +18 -0
- testerkit/data/_push_relay.py +124 -0
- testerkit/data/_runs_duckdb_daemon.py +2704 -0
- testerkit/data/_session_reaper.py +110 -0
- testerkit/data/_sql_helpers.py +30 -0
- testerkit/data/_store.py +24 -0
- testerkit/data/backends/__init__.py +7 -0
- testerkit/data/backends/_event_accumulator.py +957 -0
- testerkit/data/backends/_row_helpers.py +1172 -0
- testerkit/data/backends/parquet.py +1143 -0
- testerkit/data/backends/protocol.py +35 -0
- testerkit/data/channels/__init__.py +8 -0
- testerkit/data/channels/_flight_daemon.py +75 -0
- testerkit/data/channels/client.py +242 -0
- testerkit/data/channels/flight_manager.py +88 -0
- testerkit/data/channels/index.py +664 -0
- testerkit/data/channels/models.py +418 -0
- testerkit/data/channels/server.py +162 -0
- testerkit/data/channels/store.py +1481 -0
- testerkit/data/data_dir.py +61 -0
- testerkit/data/duckdb_manager.py +79 -0
- testerkit/data/event_log.py +384 -0
- testerkit/data/event_store.py +768 -0
- testerkit/data/events.py +1025 -0
- testerkit/data/exporters/__init__.py +6 -0
- testerkit/data/exporters/_helpers.py +40 -0
- testerkit/data/exporters/csv_exporter.py +168 -0
- testerkit/data/exporters/hdf5.py +234 -0
- testerkit/data/exporters/json_exporter.py +229 -0
- testerkit/data/exporters/mdf4.py +201 -0
- testerkit/data/exporters/stdf.py +255 -0
- testerkit/data/exporters/tdms.py +292 -0
- testerkit/data/files/__init__.py +71 -0
- testerkit/data/files/_backend.py +207 -0
- testerkit/data/files/_catalog_daemon.py +84 -0
- testerkit/data/files/catalog.py +218 -0
- testerkit/data/files/catalog_manager.py +325 -0
- testerkit/data/files/models.py +60 -0
- testerkit/data/files/serializers.py +414 -0
- testerkit/data/files/store.py +463 -0
- testerkit/data/files/streaming.py +783 -0
- testerkit/data/models.py +604 -0
- testerkit/data/ref.py +152 -0
- testerkit/data/retention.py +297 -0
- testerkit/data/run_store.py +367 -0
- testerkit/data/runs_duckdb_manager.py +103 -0
- testerkit/data/schema_dispatch.py +191 -0
- testerkit/data/schema_migrate.py +76 -0
- testerkit/data/schema_versions.py +85 -0
- testerkit/data/schemas.py +288 -0
- testerkit/data/subscribers/__init__.py +48 -0
- testerkit/data/subscribers/_base.py +20 -0
- testerkit/data/subscribers/_output_file.py +25 -0
- testerkit/data/subscribers/replay.py +55 -0
- testerkit/environment.py +84 -0
- testerkit/execution/__init__.py +11 -0
- testerkit/execution/_git.py +190 -0
- testerkit/execution/_state.py +740 -0
- testerkit/execution/accessors.py +54 -0
- testerkit/execution/audit.py +51 -0
- testerkit/execution/cascade.py +85 -0
- testerkit/execution/connections.py +491 -0
- testerkit/execution/harness.py +1931 -0
- testerkit/execution/instrument_events.py +42 -0
- testerkit/execution/limits.py +154 -0
- testerkit/execution/metadata.py +102 -0
- testerkit/execution/mocks.py +63 -0
- testerkit/execution/profiles.py +616 -0
- testerkit/execution/run_scope.py +1331 -0
- testerkit/execution/session_scope.py +196 -0
- testerkit/execution/sidecar.py +280 -0
- testerkit/execution/site_runner.py +705 -0
- testerkit/execution/sites.py +183 -0
- testerkit/execution/sync.py +294 -0
- testerkit/execution/uut_provider.py +231 -0
- testerkit/execution/vectors.py +205 -0
- testerkit/execution/verify.py +396 -0
- testerkit/expand.py +75 -0
- testerkit/files.py +235 -0
- testerkit/fixtures/__init__.py +6 -0
- testerkit/fixtures/manager.py +357 -0
- testerkit/grafana/__init__.py +1 -0
- testerkit/grafana/bootstrap.py +61 -0
- testerkit/grafana/cli.py +314 -0
- testerkit/grafana/dashboards/asset_utilization.json +92 -0
- testerkit/grafana/dashboards/channel_explorer.json +77 -0
- testerkit/grafana/dashboards/event_log.json +92 -0
- testerkit/grafana/dashboards/failure_pareto.json +104 -0
- testerkit/grafana/dashboards/measurement_distribution.json +97 -0
- testerkit/grafana/dashboards/measurement_trend.json +161 -0
- testerkit/grafana/dashboards/station_comparison.json +95 -0
- testerkit/grafana/dashboards/test_duration.json +104 -0
- testerkit/grafana/dashboards/unit_traceability.json +73 -0
- testerkit/grafana/dashboards/yield_overview.json +189 -0
- testerkit/grafana/provisioning/dashboards.yaml.j2 +12 -0
- testerkit/grafana/provisioning/datasources.yaml.j2 +17 -0
- testerkit/grafana/server.py +282 -0
- testerkit/init.py +724 -0
- testerkit/instruments/__init__.py +10 -0
- testerkit/instruments/base.py +82 -0
- testerkit/instruments/discovery/__init__.py +62 -0
- testerkit/instruments/discovery/_base.py +174 -0
- testerkit/instruments/discovery/lxi.py +152 -0
- testerkit/instruments/discovery/ni.py +95 -0
- testerkit/instruments/discovery/serial.py +73 -0
- testerkit/instruments/discovery/visa.py +98 -0
- testerkit/instruments/lifecycle.py +213 -0
- testerkit/instruments/loader.py +79 -0
- testerkit/instruments/locks.py +178 -0
- testerkit/instruments/mocks.py +230 -0
- testerkit/instruments/observer.py +270 -0
- testerkit/instruments/observers/__init__.py +36 -0
- testerkit/instruments/observers/_base.py +68 -0
- testerkit/instruments/observers/daqmx.py +70 -0
- testerkit/instruments/observers/descriptor.py +69 -0
- testerkit/instruments/observers/generic.py +92 -0
- testerkit/instruments/observers/lantz.py +31 -0
- testerkit/instruments/observers/modbus.py +96 -0
- testerkit/instruments/observers/motion.py +68 -0
- testerkit/instruments/observers/ni_modular.py +73 -0
- testerkit/instruments/observers/ophyd.py +80 -0
- testerkit/instruments/observers/pymeasure.py +120 -0
- testerkit/instruments/observers/qcodes.py +66 -0
- testerkit/instruments/observers/scpi.py +88 -0
- testerkit/instruments/observers/tektronix.py +57 -0
- testerkit/instruments/observers/visa.py +103 -0
- testerkit/instruments/pool.py +459 -0
- testerkit/instruments/proxy.py +59 -0
- testerkit/instruments/route_manager.py +329 -0
- testerkit/instruments/routed_proxy.py +88 -0
- testerkit/instruments/server.py +508 -0
- testerkit/instruments/switch.py +43 -0
- testerkit/instruments/visa.py +294 -0
- testerkit/matching/__init__.py +6 -0
- testerkit/matching/service.py +969 -0
- testerkit/mcp/__init__.py +6 -0
- testerkit/mcp/server.py +681 -0
- testerkit/mcp/tools.py +1868 -0
- testerkit/models/__init__.py +18 -0
- testerkit/models/capability.py +598 -0
- testerkit/models/catalog.py +76 -0
- testerkit/models/data_options.py +153 -0
- testerkit/models/enums.py +334 -0
- testerkit/models/instrument.py +152 -0
- testerkit/models/instrument_asset.py +25 -0
- testerkit/models/part.py +271 -0
- testerkit/models/part_manifest.py +96 -0
- testerkit/models/project.py +114 -0
- testerkit/models/station.py +140 -0
- testerkit/models/test_config.py +748 -0
- testerkit/ontology/__init__.py +39 -0
- testerkit/ontology/schema.py +188 -0
- testerkit/ontology/testerkit.yaml +1420 -0
- testerkit/parts/__init__.py +8 -0
- testerkit/parts/context.py +181 -0
- testerkit/parts/folder.py +251 -0
- testerkit/parts/loader.py +27 -0
- testerkit/prompts/__init__.py +17 -0
- testerkit/prompts/core.py +133 -0
- testerkit/pytest_plugin/__init__.py +1287 -0
- testerkit/pytest_plugin/autouse.py +369 -0
- testerkit/pytest_plugin/helpers.py +354 -0
- testerkit/pytest_plugin/hooks.py +1982 -0
- testerkit/pytest_plugin/markers.py +203 -0
- testerkit/pytest_plugin/retry.py +37 -0
- testerkit/pytest_plugin/sweeps.py +117 -0
- testerkit/queries.py +78 -0
- testerkit/reports/__init__.py +6 -0
- testerkit/reports/core.py +492 -0
- testerkit/reports/datasheet.py +831 -0
- testerkit/reports/templates/datasheet.html +383 -0
- testerkit/reports/templates/default.html +153 -0
- testerkit/sbom.py +142 -0
- testerkit/schema_export.py +101 -0
- testerkit/signals.py +63 -0
- testerkit/skills/README.md +58 -0
- testerkit/skills/templates/project-instructions.md +125 -0
- testerkit/skills/testerkit-analysis/SKILL.md +87 -0
- testerkit/skills/testerkit-capture/SKILL.md +114 -0
- testerkit/skills/testerkit-data/SKILL.md +138 -0
- testerkit/skills/testerkit-datasheets/SKILL.md +100 -0
- testerkit/skills/testerkit-datasheets/agents/scaffold-writer.md +115 -0
- testerkit/skills/testerkit-datasheets/agents/section-extractor.md +98 -0
- testerkit/skills/testerkit-datasheets/agents/section-reviewer.md +153 -0
- testerkit/skills/testerkit-datasheets/agents/section-splitter.md +89 -0
- testerkit/skills/testerkit-datasheets/agents/section-writer.md +226 -0
- testerkit/skills/testerkit-datasheets/references/catalog-pipeline.md +271 -0
- testerkit/skills/testerkit-datasheets/references/process-queue.md +42 -0
- testerkit/skills/testerkit-datasheets/references/scaffold.md +156 -0
- testerkit/skills/testerkit-datasheets/references/test-pipeline.md +312 -0
- testerkit/skills/testerkit-debug/SKILL.md +127 -0
- testerkit/skills/testerkit-interactive/SKILL.md +188 -0
- testerkit/skills/testerkit-interactive/references/live-ui-patterns.md +102 -0
- testerkit/skills/testerkit-mocks/SKILL.md +128 -0
- testerkit/skills/testerkit-parts/SKILL.md +126 -0
- testerkit/skills/testerkit-profiles/SKILL.md +139 -0
- testerkit/skills/testerkit-sites/SKILL.md +140 -0
- testerkit/skills/testerkit-stations/SKILL.md +146 -0
- testerkit/skills/testerkit-tests/SKILL.md +136 -0
- testerkit/store.py +1639 -0
- testerkit/ui/__init__.py +71 -0
- testerkit/ui/_asgi.py +162 -0
- testerkit/ui/app.py +32 -0
- testerkit/ui/components/__init__.py +13 -0
- testerkit/ui/components/artifact_viewer.py +250 -0
- testerkit/ui/components/channel_values.py +159 -0
- testerkit/ui/components/event_timeline.py +222 -0
- testerkit/ui/components/execution_gantt.py +210 -0
- testerkit/ui/components/file_streams.py +147 -0
- testerkit/ui/components/instrument_activity.py +146 -0
- testerkit/ui/components/session_table.py +118 -0
- testerkit/ui/pages/__init__.py +25 -0
- testerkit/ui/pages/channels/__init__.py +4 -0
- testerkit/ui/pages/channels/detail.py +932 -0
- testerkit/ui/pages/channels/list.py +515 -0
- testerkit/ui/pages/dashboard.py +236 -0
- testerkit/ui/pages/designer/__init__.py +5 -0
- testerkit/ui/pages/designer/graph.py +635 -0
- testerkit/ui/pages/designer/matching.py +663 -0
- testerkit/ui/pages/designer/page.py +593 -0
- testerkit/ui/pages/designer/properties.py +591 -0
- testerkit/ui/pages/designer/state.py +468 -0
- testerkit/ui/pages/docs/__init__.py +6 -0
- testerkit/ui/pages/docs/index.py +95 -0
- testerkit/ui/pages/docs/page.py +698 -0
- testerkit/ui/pages/events/__init__.py +3 -0
- testerkit/ui/pages/events/list.py +263 -0
- testerkit/ui/pages/explore.py +1108 -0
- testerkit/ui/pages/files/__init__.py +4 -0
- testerkit/ui/pages/files/detail.py +426 -0
- testerkit/ui/pages/files/list.py +447 -0
- testerkit/ui/pages/fixtures/__init__.py +8 -0
- testerkit/ui/pages/fixtures/detail.py +280 -0
- testerkit/ui/pages/fixtures/edit.py +370 -0
- testerkit/ui/pages/fixtures/list.py +180 -0
- testerkit/ui/pages/fixtures/new.py +195 -0
- testerkit/ui/pages/instruments/__init__.py +4 -0
- testerkit/ui/pages/instruments/detail.py +320 -0
- testerkit/ui/pages/instruments/edit.py +482 -0
- testerkit/ui/pages/instruments/list.py +249 -0
- testerkit/ui/pages/instruments/new.py +200 -0
- testerkit/ui/pages/launch.py +261 -0
- testerkit/ui/pages/live.py +124 -0
- testerkit/ui/pages/metrics_page.py +1229 -0
- testerkit/ui/pages/parts/__init__.py +11 -0
- testerkit/ui/pages/parts/detail.py +202 -0
- testerkit/ui/pages/parts/edit.py +310 -0
- testerkit/ui/pages/parts/list.py +160 -0
- testerkit/ui/pages/parts/new.py +170 -0
- testerkit/ui/pages/parts/requirements.py +153 -0
- testerkit/ui/pages/parts/stations.py +199 -0
- testerkit/ui/pages/profiles/__init__.py +4 -0
- testerkit/ui/pages/profiles/detail.py +113 -0
- testerkit/ui/pages/profiles/list.py +86 -0
- testerkit/ui/pages/results/__init__.py +4 -0
- testerkit/ui/pages/results/detail.py +631 -0
- testerkit/ui/pages/results/list.py +230 -0
- testerkit/ui/pages/stations/__init__.py +4 -0
- testerkit/ui/pages/stations/detail.py +256 -0
- testerkit/ui/pages/stations/edit.py +273 -0
- testerkit/ui/pages/stations/list.py +180 -0
- testerkit/ui/pages/stations/new.py +311 -0
- testerkit/ui/pages/tests/__init__.py +4 -0
- testerkit/ui/pages/tests/detail.py +152 -0
- testerkit/ui/pages/tests/list.py +194 -0
- testerkit/ui/pages/uuts/__init__.py +4 -0
- testerkit/ui/pages/uuts/list.py +97 -0
- testerkit/ui/shared/__init__.py +8 -0
- testerkit/ui/shared/components.py +1826 -0
- testerkit/ui/shared/dialogs.py +105 -0
- testerkit/ui/shared/event_binding.py +194 -0
- testerkit/ui/shared/layout.py +314 -0
- testerkit/ui/shared/services.py +1719 -0
- testerkit/ui/shared/timestamps.py +21 -0
- testerkit/ui/static/branding/favicon-16.png +0 -0
- testerkit/ui/static/branding/favicon-32.png +0 -0
- testerkit/ui/static/branding/favicon-48.png +0 -0
- testerkit/ui/static/branding/testerkit-icon-256.png +0 -0
- testerkit/ui/static/branding/testerkit-mark.svg +1 -0
- testerkit/ui/static/branding/testerkit-wordmark.svg +1 -0
- testerkit/ui/static/global.css +465 -0
- testerkit/utils/__init__.py +17 -0
- testerkit/utils/enum_meta.py +800 -0
- testerkit/utils/paths.py +75 -0
- testerkit/utils/ranges.py +257 -0
- testerkit/validation.py +82 -0
- testerkit/verbs.py +142 -0
- testerkit-0.4.0.dist-info/METADATA +250 -0
- testerkit-0.4.0.dist-info/RECORD +521 -0
- testerkit-0.4.0.dist-info/WHEEL +4 -0
- testerkit-0.4.0.dist-info/entry_points.txt +5 -0
- testerkit-0.4.0.dist-info/licenses/LICENSE +191 -0
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
"""Properties drawer panels for the system designer.
|
|
2
|
+
|
|
3
|
+
Provides contextual editing panels for pins, instruments, and connections
|
|
4
|
+
in a right-hand slide-in drawer. Also contains Add Pin and Add Instrument dialogs.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from collections.abc import Callable
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
from nicegui import ui
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from testerkit.models.station import StationConfig
|
|
16
|
+
from testerkit.ui.pages.designer.state import DesignerState
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def create_properties_drawer() -> ui.right_drawer:
|
|
20
|
+
"""Create the right-hand properties drawer (initially hidden)."""
|
|
21
|
+
drawer = ui.right_drawer(value=False).classes("bg-white border-l border-slate-200")
|
|
22
|
+
drawer.props("width=320 bordered overlay")
|
|
23
|
+
return drawer
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def show_pin_properties(
|
|
27
|
+
pin_key: str,
|
|
28
|
+
state: DesignerState,
|
|
29
|
+
drawer: ui.right_drawer,
|
|
30
|
+
rebuild: Callable,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""Render pin editing form in the drawer."""
|
|
33
|
+
pin = state.uut_pins.get(pin_key)
|
|
34
|
+
if not pin:
|
|
35
|
+
return
|
|
36
|
+
|
|
37
|
+
drawer.clear()
|
|
38
|
+
with drawer:
|
|
39
|
+
with ui.column().classes("w-full p-4 gap-3"):
|
|
40
|
+
# Header
|
|
41
|
+
with ui.row().classes("w-full items-center justify-between"):
|
|
42
|
+
ui.label("Pin Properties").classes("text-lg font-semibold text-slate-800")
|
|
43
|
+
_close_button(state, drawer, rebuild)
|
|
44
|
+
|
|
45
|
+
ui.label(pin_key).classes("text-sm font-mono text-slate-500 -mt-2")
|
|
46
|
+
ui.separator()
|
|
47
|
+
|
|
48
|
+
# Editable fields
|
|
49
|
+
ui.input(
|
|
50
|
+
"Name",
|
|
51
|
+
value=pin.get("name", ""),
|
|
52
|
+
on_change=lambda e, k=pin_key: _update_pin_field(
|
|
53
|
+
state, k, "name", e.value, rebuild
|
|
54
|
+
),
|
|
55
|
+
).classes("w-full")
|
|
56
|
+
|
|
57
|
+
ui.input(
|
|
58
|
+
"Net",
|
|
59
|
+
value=pin.get("net", ""),
|
|
60
|
+
on_change=lambda e, k=pin_key: _update_pin_field(state, k, "net", e.value, rebuild),
|
|
61
|
+
).classes("w-full")
|
|
62
|
+
|
|
63
|
+
ui.input(
|
|
64
|
+
"Description",
|
|
65
|
+
value=pin.get("description", ""),
|
|
66
|
+
on_change=lambda e, k=pin_key: _update_pin_field(
|
|
67
|
+
state, k, "description", e.value, rebuild
|
|
68
|
+
),
|
|
69
|
+
).classes("w-full")
|
|
70
|
+
|
|
71
|
+
# Characteristics section (read-only)
|
|
72
|
+
chars = state.char_by_pin.get(pin_key, [])
|
|
73
|
+
if chars:
|
|
74
|
+
ui.separator()
|
|
75
|
+
ui.label("Characteristics").classes("text-sm font-semibold text-slate-600")
|
|
76
|
+
for char_name in chars:
|
|
77
|
+
with ui.row().classes("items-center gap-1"):
|
|
78
|
+
ui.icon("tune").classes("text-slate-400 text-sm")
|
|
79
|
+
ui.label(char_name).classes("text-sm text-slate-600")
|
|
80
|
+
|
|
81
|
+
# Connection info (read-only)
|
|
82
|
+
conns = state.find_connections_for_pin(pin_key)
|
|
83
|
+
if conns:
|
|
84
|
+
ui.separator()
|
|
85
|
+
ui.label("Connected to").classes("text-sm font-semibold text-slate-600")
|
|
86
|
+
for conn in conns:
|
|
87
|
+
conn_text = f"{conn['instrument']}:{conn['channel']}"
|
|
88
|
+
if conn.get("terminal"):
|
|
89
|
+
conn_text += f":{conn['terminal']}"
|
|
90
|
+
ui.label(conn_text).classes("text-sm font-mono text-green-600")
|
|
91
|
+
|
|
92
|
+
# Delete button
|
|
93
|
+
ui.separator()
|
|
94
|
+
ui.button(
|
|
95
|
+
"Delete Pin",
|
|
96
|
+
icon="delete",
|
|
97
|
+
on_click=lambda: _delete_pin(state, pin_key, drawer, rebuild),
|
|
98
|
+
color="red",
|
|
99
|
+
).props("flat").classes("w-full")
|
|
100
|
+
|
|
101
|
+
drawer.value = True
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def show_instrument_properties(
|
|
105
|
+
role: str,
|
|
106
|
+
state: DesignerState,
|
|
107
|
+
drawer: ui.right_drawer,
|
|
108
|
+
rebuild: Callable,
|
|
109
|
+
) -> None:
|
|
110
|
+
"""Render instrument editing form in the drawer."""
|
|
111
|
+
inst = state.instruments.get(role)
|
|
112
|
+
if not inst:
|
|
113
|
+
return
|
|
114
|
+
|
|
115
|
+
drawer.clear()
|
|
116
|
+
with drawer:
|
|
117
|
+
with ui.column().classes("w-full p-4 gap-3"):
|
|
118
|
+
# Header
|
|
119
|
+
with ui.row().classes("w-full items-center justify-between"):
|
|
120
|
+
ui.label("Instrument").classes("text-lg font-semibold text-slate-800")
|
|
121
|
+
_close_button(state, drawer, rebuild)
|
|
122
|
+
|
|
123
|
+
ui.separator()
|
|
124
|
+
|
|
125
|
+
# Role name (readonly)
|
|
126
|
+
ui.input("Role", value=role).classes("w-full").props("readonly")
|
|
127
|
+
|
|
128
|
+
# Driver
|
|
129
|
+
ui.input(
|
|
130
|
+
"Driver",
|
|
131
|
+
value=inst.get("driver", ""),
|
|
132
|
+
on_change=lambda e: _update_instrument_field(state, role, "driver", e.value),
|
|
133
|
+
).classes("w-full")
|
|
134
|
+
|
|
135
|
+
# Type
|
|
136
|
+
ui.input(
|
|
137
|
+
"Type",
|
|
138
|
+
value=inst.get("type", ""),
|
|
139
|
+
on_change=lambda e: _update_instrument_field(state, role, "type", e.value),
|
|
140
|
+
).classes("w-full")
|
|
141
|
+
|
|
142
|
+
# Channels section with catalog details
|
|
143
|
+
ui.separator()
|
|
144
|
+
ui.label("Channels").classes("text-sm font-semibold text-slate-600")
|
|
145
|
+
|
|
146
|
+
channel_details = inst.get("channel_details", {})
|
|
147
|
+
channels_container = ui.column().classes("w-full gap-2")
|
|
148
|
+
|
|
149
|
+
def _rebuild_channels():
|
|
150
|
+
channels_container.clear()
|
|
151
|
+
with channels_container:
|
|
152
|
+
for ch in inst.get("channels", []):
|
|
153
|
+
ch_detail = channel_details.get(ch, {})
|
|
154
|
+
ch_label = ch_detail.get("label", ch)
|
|
155
|
+
if ch.isdigit() and not ch_detail.get("label"):
|
|
156
|
+
ch_label = f"CH{ch}"
|
|
157
|
+
is_used = state.is_channel_used(role, ch)
|
|
158
|
+
ground = ch_detail.get("ground", "unknown")
|
|
159
|
+
terminals = ch_detail.get("terminals", [])
|
|
160
|
+
connector = ch_detail.get("connector", "")
|
|
161
|
+
|
|
162
|
+
with ui.card().classes("w-full p-2").props("flat bordered"):
|
|
163
|
+
with ui.row().classes("items-center justify-between w-full"):
|
|
164
|
+
with ui.row().classes("items-center gap-2"):
|
|
165
|
+
ui.label(ch_label).classes(
|
|
166
|
+
"text-sm font-mono font-semibold "
|
|
167
|
+
+ ("text-green-600" if is_used else "text-slate-700")
|
|
168
|
+
)
|
|
169
|
+
if is_used:
|
|
170
|
+
ui.icon("link").classes("text-green-500 text-sm")
|
|
171
|
+
# Ground indicator - only if there's a wirable ground terminal
|
|
172
|
+
gnd_names = {
|
|
173
|
+
"lo",
|
|
174
|
+
"gnd",
|
|
175
|
+
"ground",
|
|
176
|
+
"return",
|
|
177
|
+
"com",
|
|
178
|
+
"sense_lo",
|
|
179
|
+
"shield",
|
|
180
|
+
}
|
|
181
|
+
has_gnd = any(t.lower() in gnd_names for t in terminals)
|
|
182
|
+
if has_gnd:
|
|
183
|
+
if ground == "shared":
|
|
184
|
+
ui.badge("⏚ shared", color="green").props("outline dense")
|
|
185
|
+
elif ground == "floating":
|
|
186
|
+
ui.badge("⏊ floating", color="amber").props("outline dense")
|
|
187
|
+
|
|
188
|
+
# Catalog details (read-only)
|
|
189
|
+
if terminals or connector:
|
|
190
|
+
with ui.row().classes("gap-3 mt-1"):
|
|
191
|
+
if terminals:
|
|
192
|
+
ui.label(f"Terminals: {', '.join(terminals)}").classes(
|
|
193
|
+
"text-xs text-slate-500"
|
|
194
|
+
)
|
|
195
|
+
if connector:
|
|
196
|
+
ui.label(f"Connector: {connector}").classes(
|
|
197
|
+
"text-xs text-slate-500"
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
_rebuild_channels()
|
|
201
|
+
|
|
202
|
+
# Catalog reference
|
|
203
|
+
catalog_ref = inst.get("catalog_ref")
|
|
204
|
+
if catalog_ref:
|
|
205
|
+
ui.separator()
|
|
206
|
+
with ui.row().classes("items-center gap-2"):
|
|
207
|
+
ui.icon("inventory_2").classes("text-slate-400 text-sm")
|
|
208
|
+
ui.label(f"Catalog: {catalog_ref}").classes("text-xs text-slate-500 font-mono")
|
|
209
|
+
|
|
210
|
+
# Capabilities (read-only)
|
|
211
|
+
caps = inst.get("capabilities", [])
|
|
212
|
+
if caps:
|
|
213
|
+
ui.separator()
|
|
214
|
+
ui.label("Capabilities").classes("text-sm font-semibold text-slate-600")
|
|
215
|
+
for cap in caps:
|
|
216
|
+
name = cap.get(
|
|
217
|
+
"name",
|
|
218
|
+
f"{cap.get('direction', '')} {cap.get('function', '')}",
|
|
219
|
+
)
|
|
220
|
+
ui.label(name).classes("text-sm text-slate-500")
|
|
221
|
+
else:
|
|
222
|
+
ui.separator()
|
|
223
|
+
ui.label("No capability data (library)").classes("text-xs text-slate-400 italic")
|
|
224
|
+
|
|
225
|
+
# Connected pins
|
|
226
|
+
connected = [conn for conn in state.connections.values() if conn["instrument"] == role]
|
|
227
|
+
if connected:
|
|
228
|
+
ui.separator()
|
|
229
|
+
ui.label("Connected Pins").classes("text-sm font-semibold text-slate-600")
|
|
230
|
+
for conn in connected:
|
|
231
|
+
target = f"CH{conn['channel']}"
|
|
232
|
+
if conn.get("terminal"):
|
|
233
|
+
target += f":{conn['terminal'].upper()}"
|
|
234
|
+
ui.label(f"{conn['uut_pin']} -> {target}").classes(
|
|
235
|
+
"text-sm text-slate-500 font-mono"
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
# Delete button
|
|
239
|
+
ui.separator()
|
|
240
|
+
ui.button(
|
|
241
|
+
"Delete Instrument",
|
|
242
|
+
icon="delete",
|
|
243
|
+
on_click=lambda: _delete_instrument(state, role, drawer, rebuild),
|
|
244
|
+
color="red",
|
|
245
|
+
).props("flat").classes("w-full")
|
|
246
|
+
|
|
247
|
+
drawer.value = True
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def show_connection_properties(
|
|
251
|
+
point_name: str,
|
|
252
|
+
state: DesignerState,
|
|
253
|
+
drawer: ui.right_drawer,
|
|
254
|
+
rebuild: Callable,
|
|
255
|
+
) -> None:
|
|
256
|
+
"""Render connection details in the drawer."""
|
|
257
|
+
conn = state.connections.get(point_name)
|
|
258
|
+
if not conn:
|
|
259
|
+
return
|
|
260
|
+
|
|
261
|
+
drawer.clear()
|
|
262
|
+
with drawer:
|
|
263
|
+
with ui.column().classes("w-full p-4 gap-3"):
|
|
264
|
+
# Header
|
|
265
|
+
with ui.row().classes("w-full items-center justify-between"):
|
|
266
|
+
ui.label("Connection").classes("text-lg font-semibold text-slate-800")
|
|
267
|
+
_close_button(state, drawer, rebuild)
|
|
268
|
+
|
|
269
|
+
ui.separator()
|
|
270
|
+
|
|
271
|
+
# Point name (readonly)
|
|
272
|
+
ui.input("Point Name", value=point_name).classes("w-full").props("readonly")
|
|
273
|
+
|
|
274
|
+
# Read-only fields
|
|
275
|
+
ui.input("UUT Pin", value=conn.get("uut_pin", "")).classes("w-full").props("readonly")
|
|
276
|
+
ui.input("Net", value=conn.get("net", "")).classes("w-full").props("readonly")
|
|
277
|
+
ui.input("Instrument", value=conn.get("instrument", "")).classes("w-full").props(
|
|
278
|
+
"readonly"
|
|
279
|
+
)
|
|
280
|
+
ui.input("Channel", value=conn.get("channel", "")).classes("w-full").props("readonly")
|
|
281
|
+
if conn.get("terminal"):
|
|
282
|
+
ui.input("Terminal", value=conn.get("terminal", "")).classes("w-full").props(
|
|
283
|
+
"readonly"
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
# Delete button
|
|
287
|
+
ui.separator()
|
|
288
|
+
ui.button(
|
|
289
|
+
"Delete Connection",
|
|
290
|
+
icon="link_off",
|
|
291
|
+
on_click=lambda: _delete_connection(state, point_name, drawer, rebuild),
|
|
292
|
+
color="red",
|
|
293
|
+
).props("flat").classes("w-full")
|
|
294
|
+
|
|
295
|
+
drawer.value = True
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# ---------------------------------------------------------------------------
|
|
299
|
+
# Dialogs
|
|
300
|
+
# ---------------------------------------------------------------------------
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def show_add_pin_dialog(state: DesignerState, rebuild: Callable) -> None:
|
|
304
|
+
"""Show dialog to add a new UUT pin."""
|
|
305
|
+
form: dict = {"key": "", "name": "", "net": ""}
|
|
306
|
+
|
|
307
|
+
with ui.dialog() as dialog, ui.card().classes("w-96"):
|
|
308
|
+
ui.label("Add UUT Pin").classes("text-lg font-semibold")
|
|
309
|
+
ui.separator()
|
|
310
|
+
|
|
311
|
+
ui.input("Pin Key", placeholder="e.g. TP_VOUT").classes("w-full").bind_value(form, "key")
|
|
312
|
+
|
|
313
|
+
ui.input("Pin Name", placeholder="e.g. TP5").classes("w-full").bind_value(form, "name")
|
|
314
|
+
|
|
315
|
+
ui.input("Net", placeholder="e.g. VOUT_3V3").classes("w-full").bind_value(form, "net")
|
|
316
|
+
|
|
317
|
+
with ui.row().classes("w-full justify-end gap-2 mt-2"):
|
|
318
|
+
ui.button("Cancel", on_click=dialog.close).props("flat")
|
|
319
|
+
|
|
320
|
+
def _add():
|
|
321
|
+
if not form["key"]:
|
|
322
|
+
ui.notify("Pin key is required", type="warning")
|
|
323
|
+
elif form["key"] in state.uut_pins:
|
|
324
|
+
ui.notify("Pin key already exists", type="warning")
|
|
325
|
+
else:
|
|
326
|
+
state.add_pin(form["key"], form["name"], form["net"])
|
|
327
|
+
dialog.close()
|
|
328
|
+
rebuild()
|
|
329
|
+
|
|
330
|
+
ui.button("Add", on_click=_add, color="primary")
|
|
331
|
+
|
|
332
|
+
dialog.open()
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def show_add_instrument_dialog(
|
|
336
|
+
state: DesignerState,
|
|
337
|
+
rebuild: Callable,
|
|
338
|
+
instrument_types: list[dict] | None = None,
|
|
339
|
+
) -> None:
|
|
340
|
+
"""Show dialog to add an instrument."""
|
|
341
|
+
form: dict = {"role": "", "driver": "", "channels": "1", "type": ""}
|
|
342
|
+
|
|
343
|
+
with ui.dialog() as dialog, ui.card().classes("w-96"):
|
|
344
|
+
ui.label("Add Instrument").classes("text-lg font-semibold")
|
|
345
|
+
ui.separator()
|
|
346
|
+
|
|
347
|
+
# If library types available, show dropdown
|
|
348
|
+
if instrument_types:
|
|
349
|
+
type_options = {t["type"]: t["name"] for t in instrument_types}
|
|
350
|
+
|
|
351
|
+
def _on_type_select(e):
|
|
352
|
+
selected = e.value
|
|
353
|
+
for t in instrument_types:
|
|
354
|
+
if t["type"] == selected:
|
|
355
|
+
form["type"] = t["type"]
|
|
356
|
+
form["driver"] = ""
|
|
357
|
+
caps = t.get("capability_details", [])
|
|
358
|
+
ch_names = set()
|
|
359
|
+
for cap in caps:
|
|
360
|
+
channels_spec = cap.get("channels", {})
|
|
361
|
+
if isinstance(channels_spec, dict):
|
|
362
|
+
count = channels_spec.get("count", 1)
|
|
363
|
+
naming = channels_spec.get("naming")
|
|
364
|
+
if naming:
|
|
365
|
+
ch_names.update(naming.format(n=i + 1) for i in range(count))
|
|
366
|
+
else:
|
|
367
|
+
ch_names.update(str(i + 1) for i in range(count))
|
|
368
|
+
if ch_names:
|
|
369
|
+
form["channels"] = ", ".join(sorted(ch_names))
|
|
370
|
+
break
|
|
371
|
+
|
|
372
|
+
ui.select(
|
|
373
|
+
type_options,
|
|
374
|
+
label="Instrument Type (optional)",
|
|
375
|
+
on_change=_on_type_select,
|
|
376
|
+
).classes("w-full")
|
|
377
|
+
|
|
378
|
+
ui.input("Role Name", placeholder='e.g. "dmm", "psu"').classes("w-full").bind_value(
|
|
379
|
+
form, "role"
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
ui.input("Driver", placeholder="e.g. examples.drivers.DMM").classes("w-full").bind_value(
|
|
383
|
+
form, "driver"
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
ui.input("Channels", placeholder="e.g. 1, 2 or CH1, CH2").classes("w-full").bind_value(
|
|
387
|
+
form, "channels"
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
with ui.row().classes("w-full justify-end gap-2 mt-2"):
|
|
391
|
+
ui.button("Cancel", on_click=dialog.close).props("flat")
|
|
392
|
+
|
|
393
|
+
def _add():
|
|
394
|
+
if not form["role"]:
|
|
395
|
+
ui.notify("Role name is required", type="warning")
|
|
396
|
+
elif form["role"] in state.instruments:
|
|
397
|
+
ui.notify("Role name already exists", type="warning")
|
|
398
|
+
else:
|
|
399
|
+
channels = [c.strip() for c in form["channels"].split(",") if c.strip()]
|
|
400
|
+
if not channels:
|
|
401
|
+
channels = ["1"]
|
|
402
|
+
|
|
403
|
+
caps: list[dict] = []
|
|
404
|
+
if instrument_types and form.get("type"):
|
|
405
|
+
for t in instrument_types:
|
|
406
|
+
if t["type"] == form["type"]:
|
|
407
|
+
caps = t.get("capability_details", [])
|
|
408
|
+
break
|
|
409
|
+
|
|
410
|
+
state.add_instrument(
|
|
411
|
+
form["role"],
|
|
412
|
+
form.get("type", ""),
|
|
413
|
+
form["driver"],
|
|
414
|
+
caps,
|
|
415
|
+
channels,
|
|
416
|
+
)
|
|
417
|
+
dialog.close()
|
|
418
|
+
rebuild()
|
|
419
|
+
|
|
420
|
+
ui.button("Add", on_click=_add, color="primary")
|
|
421
|
+
|
|
422
|
+
dialog.open()
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def show_load_station_dialog(
|
|
426
|
+
state: DesignerState,
|
|
427
|
+
stations: list[StationConfig],
|
|
428
|
+
load_station_fn: Callable,
|
|
429
|
+
rebuild: Callable,
|
|
430
|
+
) -> None:
|
|
431
|
+
"""Show dialog to load instruments from an existing station."""
|
|
432
|
+
with ui.dialog() as dialog, ui.card().classes("w-96"):
|
|
433
|
+
ui.label("Load Station").classes("text-lg font-semibold")
|
|
434
|
+
ui.separator()
|
|
435
|
+
|
|
436
|
+
if not stations:
|
|
437
|
+
ui.label("No stations found.").classes("text-slate-500")
|
|
438
|
+
ui.button("Close", on_click=dialog.close).props("flat")
|
|
439
|
+
else:
|
|
440
|
+
station_options = {s.id: s.name or s.id for s in stations}
|
|
441
|
+
selected = {"station_id": ""}
|
|
442
|
+
|
|
443
|
+
ui.select(station_options, label="Station", with_input=True).classes(
|
|
444
|
+
"w-full"
|
|
445
|
+
).bind_value(selected, "station_id")
|
|
446
|
+
|
|
447
|
+
ui.label("This will import all instruments from the selected station.").classes(
|
|
448
|
+
"text-xs text-slate-500"
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
with ui.row().classes("w-full justify-end gap-2 mt-2"):
|
|
452
|
+
ui.button("Cancel", on_click=dialog.close).props("flat")
|
|
453
|
+
|
|
454
|
+
def _load():
|
|
455
|
+
if selected["station_id"]:
|
|
456
|
+
config = load_station_fn(selected["station_id"])
|
|
457
|
+
if config:
|
|
458
|
+
from testerkit.ui.pages.designer.matching import (
|
|
459
|
+
resolve_instrument_capabilities,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
config = resolve_instrument_capabilities(config)
|
|
463
|
+
state.load_station(config)
|
|
464
|
+
dialog.close()
|
|
465
|
+
rebuild()
|
|
466
|
+
ui.notify(
|
|
467
|
+
f"Loaded station {selected['station_id']}",
|
|
468
|
+
type="positive",
|
|
469
|
+
)
|
|
470
|
+
else:
|
|
471
|
+
ui.notify("Failed to load station", type="negative")
|
|
472
|
+
|
|
473
|
+
ui.button("Load", on_click=_load, color="primary")
|
|
474
|
+
|
|
475
|
+
dialog.open()
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
# ---------------------------------------------------------------------------
|
|
479
|
+
# Internal helpers
|
|
480
|
+
# ---------------------------------------------------------------------------
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def _close_button(state: DesignerState, drawer: ui.right_drawer, rebuild: Callable) -> None:
|
|
484
|
+
"""Render a close button for the properties drawer."""
|
|
485
|
+
|
|
486
|
+
def on_close():
|
|
487
|
+
state.clear_selection()
|
|
488
|
+
drawer.value = False
|
|
489
|
+
rebuild()
|
|
490
|
+
|
|
491
|
+
ui.button(icon="close", on_click=on_close).props("flat dense round").classes("text-slate-400")
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
def _update_pin_field(
|
|
495
|
+
state: DesignerState,
|
|
496
|
+
pin_key: str,
|
|
497
|
+
field: str,
|
|
498
|
+
value: str,
|
|
499
|
+
rebuild: Callable,
|
|
500
|
+
) -> None:
|
|
501
|
+
"""Update a single pin field."""
|
|
502
|
+
state.edit_pin(pin_key, **{field: value})
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
def _update_instrument_field(state: DesignerState, role: str, field: str, value: str) -> None:
|
|
506
|
+
"""Update a single instrument field."""
|
|
507
|
+
if role in state.instruments:
|
|
508
|
+
state.instruments[role][field] = value
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
def _delete_pin(
|
|
512
|
+
state: DesignerState,
|
|
513
|
+
pin_key: str,
|
|
514
|
+
drawer: ui.right_drawer,
|
|
515
|
+
rebuild: Callable,
|
|
516
|
+
) -> None:
|
|
517
|
+
"""Delete a pin and close drawer."""
|
|
518
|
+
state.remove_pin(pin_key)
|
|
519
|
+
state.clear_selection()
|
|
520
|
+
drawer.value = False
|
|
521
|
+
rebuild()
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
def _delete_instrument(
|
|
525
|
+
state: DesignerState,
|
|
526
|
+
role: str,
|
|
527
|
+
drawer: ui.right_drawer,
|
|
528
|
+
rebuild: Callable,
|
|
529
|
+
) -> None:
|
|
530
|
+
"""Delete an instrument and close drawer."""
|
|
531
|
+
state.remove_instrument(role)
|
|
532
|
+
state.clear_selection()
|
|
533
|
+
drawer.value = False
|
|
534
|
+
rebuild()
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
def _delete_connection(
|
|
538
|
+
state: DesignerState,
|
|
539
|
+
point_name: str,
|
|
540
|
+
drawer: ui.right_drawer,
|
|
541
|
+
rebuild: Callable,
|
|
542
|
+
) -> None:
|
|
543
|
+
"""Delete a connection and close drawer."""
|
|
544
|
+
state.remove_connection(point_name)
|
|
545
|
+
state.clear_selection()
|
|
546
|
+
drawer.value = False
|
|
547
|
+
rebuild()
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def _remove_channel(
|
|
551
|
+
state: DesignerState,
|
|
552
|
+
role: str,
|
|
553
|
+
channel: str,
|
|
554
|
+
rebuild: Callable,
|
|
555
|
+
rebuild_channels: Callable,
|
|
556
|
+
) -> None:
|
|
557
|
+
"""Remove a channel from an instrument."""
|
|
558
|
+
inst = state.instruments.get(role)
|
|
559
|
+
if inst and channel in inst.get("channels", []):
|
|
560
|
+
to_remove = [
|
|
561
|
+
name
|
|
562
|
+
for name, conn in state.connections.items()
|
|
563
|
+
if conn["instrument"] == role and conn["channel"] == channel
|
|
564
|
+
]
|
|
565
|
+
for name in to_remove:
|
|
566
|
+
del state.connections[name]
|
|
567
|
+
inst["channels"].remove(channel)
|
|
568
|
+
rebuild_channels()
|
|
569
|
+
rebuild()
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
def _add_channel(
|
|
573
|
+
state: DesignerState,
|
|
574
|
+
role: str,
|
|
575
|
+
input_elem: ui.input,
|
|
576
|
+
rebuild: Callable,
|
|
577
|
+
rebuild_channels: Callable,
|
|
578
|
+
) -> None:
|
|
579
|
+
"""Add a channel to an instrument."""
|
|
580
|
+
ch = input_elem.value.strip()
|
|
581
|
+
if not ch:
|
|
582
|
+
return
|
|
583
|
+
inst = state.instruments.get(role)
|
|
584
|
+
if inst:
|
|
585
|
+
channels = inst.get("channels", [])
|
|
586
|
+
if ch not in channels:
|
|
587
|
+
channels.append(ch)
|
|
588
|
+
inst["channels"] = channels
|
|
589
|
+
input_elem.value = ""
|
|
590
|
+
rebuild_channels()
|
|
591
|
+
rebuild()
|