struct2ui 0.5.0__tar.gz → 0.6.0__tar.gz
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.
- {struct2ui-0.5.0/src/struct2ui.egg-info → struct2ui-0.6.0}/PKG-INFO +54 -12
- {struct2ui-0.5.0 → struct2ui-0.6.0}/README.md +53 -11
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/__init__.py +1 -1
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/editor.py +231 -46
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/schema.py +48 -24
- {struct2ui-0.5.0 → struct2ui-0.6.0/src/struct2ui.egg-info}/PKG-INFO +54 -12
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_c_parser.py +1 -1
- struct2ui-0.6.0/tests/test_editor.py +615 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_json_format.py +1 -1
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_load_report.py +140 -116
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_save.py +258 -258
- struct2ui-0.5.0/tests/test_editor.py +0 -287
- {struct2ui-0.5.0 → struct2ui-0.6.0}/LICENSE +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/pyproject.toml +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/setup.cfg +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/__init__.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/bin_emitter.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/bin_reader.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/c_emitter.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/c_parser.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/elf_verifier.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/exporters/json_format.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/c2j.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/elf.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/export_notes_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/flowchart_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/refresh_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/report_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/save_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/save_as_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/settings_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/icons/widgets_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/ui/__init__.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/ui/renderers.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/ui/tables.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui/ui/widgets.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui.egg-info/SOURCES.txt +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui.egg-info/dependency_links.txt +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui.egg-info/requires.txt +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/src/struct2ui.egg-info/top_level.txt +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_bin_emitter.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_bin_reader.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_c_emitter.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_choices.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_container_verify.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_elf_verifier.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_float_precision.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_int_checkbox.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_macro_bounds.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_union.py +0 -0
- {struct2ui-0.5.0 → struct2ui-0.6.0}/tests/test_value_readback.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: struct2ui
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Render C struct / JSON schema as editable PySide6 UI, export to C/JSON/bin
|
|
5
5
|
Author-email: Jay <huoyj0108@163.com>
|
|
6
6
|
License: MIT License
|
|
@@ -63,6 +63,7 @@ Render C structs / JSON schemas as an **editable PySide6 UI**, and convert freel
|
|
|
63
63
|
- **Read bin back**: `import_bin` loads a raw `.bin` (e.g. read back from the chip) into the UI — the byte-for-byte inverse of the binary export.
|
|
64
64
|
- **Validation**: keyword spell-checking (with “Did you mean X?” hints), semantic audits (`min<=max`, `step>0`), and pipeline cross-validation.
|
|
65
65
|
- **ELF layout check**: optionally verify each module — and the whole pipeline against its SDK container struct — against a compiled ELF's DWARF layout, catching offset/size drift and wrong stage order.
|
|
66
|
+
- **Pipeline note sources**: a pipeline file can pin its own Modules / ELF paths (`note` → `"Modules"` / `"ELF"`) — picking one file switches the whole setup, while the UI-picked paths keep the highest priority.
|
|
66
67
|
- **Qt-binding agnostic**: built on [Qt.py](https://github.com/mottosso/Qt.py) — works with PySide6 / PyQt6 / PySide2 / PyQt5.
|
|
67
68
|
|
|
68
69
|
## Installation
|
|
@@ -91,8 +92,8 @@ app = QtWidgets.QApplication([])
|
|
|
91
92
|
|
|
92
93
|
editor = StructEditor()
|
|
93
94
|
editor.set_sources(
|
|
94
|
-
cfg_dir="cfg_t", # modules dir: *.json holding struct/enum/typedef
|
|
95
95
|
flow_file="abc.json", # pipeline definition file
|
|
96
|
+
cfg_dir="cfg_t", # modules dir: *.json holding struct/enum/typedef
|
|
96
97
|
)
|
|
97
98
|
editor.resize(480, 600)
|
|
98
99
|
editor.show()
|
|
@@ -265,6 +266,9 @@ Loading runs three layers of checks, surfaced in the **load report** panel:
|
|
|
265
266
|
bounds, default is one of the choices.
|
|
266
267
|
- **Pipeline cross-validation** — values in the pipeline file are checked
|
|
267
268
|
against the schema (range, choices, enum membership).
|
|
269
|
+
- **Duplicate type definitions** — the same struct / enum / union defined in
|
|
270
|
+
two module files is an error; the first definition found wins and the
|
|
271
|
+
duplicate is reported.
|
|
268
272
|
|
|
269
273
|
## Pipeline File
|
|
270
274
|
|
|
@@ -277,7 +281,8 @@ tuning name) whose value is the group body:
|
|
|
277
281
|
```jsonc
|
|
278
282
|
{
|
|
279
283
|
"Speech Tuning": {
|
|
280
|
-
"
|
|
284
|
+
"note": { "Modules": "cfg_t", "ELF": "../elf/fw.elf" }, // optional sources
|
|
285
|
+
"flow": ["RX NS", "RX DRC", "RX EQ"], // stage order, optional
|
|
281
286
|
"container": "SpeechConfig", // optional, enables layout check
|
|
282
287
|
|
|
283
288
|
"RX NS": { "type": "SpeechNs2FloatConfig", "items": { /* values */ } },
|
|
@@ -291,14 +296,45 @@ tuning name) whose value is the group body:
|
|
|
291
296
|
|
|
292
297
|
| Key | Required | Notes |
|
|
293
298
|
| --- | --- | --- |
|
|
294
|
-
| `flow` |
|
|
299
|
+
| `flow` | no | Ordered list of stage names. The flow buttons and the export order follow it. **Omit it and the stages run in the order they appear in the JSON.** When present, every listed name must have a stage block; defined stages missing from `flow` are a warning. |
|
|
295
300
|
| `container` | no | Name of the SDK struct that holds all modules (see [Container layout check](#container-layout-check)). Omit to disable that check. |
|
|
301
|
+
| `note` | no | Free-form metadata dict. Two keys are special — `"Modules"` / `"ELF"` pin the pipeline's companion sources (see [Source overrides via `note`](#source-overrides-via-note)); everything else in it is ignored. |
|
|
296
302
|
| *stage name* | — | Any other key is a **stage block**; its name is the label shown on the flow button. |
|
|
297
303
|
|
|
298
304
|
All keys are **lowercase and case-sensitive** — write `flow`, not `Flow`. A
|
|
299
305
|
mistyped key (`Flow`, `flwo`, …) is reported with a "Did you mean `flow`?" hint.
|
|
300
|
-
Free-form metadata keys (`version`, `description`, `author`, `comment
|
|
301
|
-
|
|
306
|
+
Free-form metadata keys (`version`, `description`, `author`, `comment`) are
|
|
307
|
+
allowed and ignored.
|
|
308
|
+
|
|
309
|
+
### Source overrides via `note`
|
|
310
|
+
|
|
311
|
+
A pipeline file can pin its own companion sources, so picking **one file
|
|
312
|
+
switches the whole tuning setup** — no need to re-pick the Modules directory
|
|
313
|
+
and ELF by hand:
|
|
314
|
+
|
|
315
|
+
```jsonc
|
|
316
|
+
"note": {
|
|
317
|
+
"Send Format": "Speech Tuning", // free-form fields stay ignored
|
|
318
|
+
"Modules": "cfg_t", // modules directory
|
|
319
|
+
"ELF": "../elf/best1702_ibrt.elf" // ELF for layout verification
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Both keys are optional and take absolute or **pipeline-file-relative** paths.
|
|
324
|
+
Selecting the pipeline applies them in Settings:
|
|
325
|
+
|
|
326
|
+
- The matching row's checkbox is **unchecked** — exactly as if the user had —
|
|
327
|
+
and the note's path feeds the slot. The checkbox stays clickable and the
|
|
328
|
+
UI-picked path is kept and still displayed, so re-checking the row switches
|
|
329
|
+
back to it at any time.
|
|
330
|
+
- **UI settings always win**: a checked row forces the UI-picked path no
|
|
331
|
+
matter what the note says. The note can only take over a row the user left
|
|
332
|
+
unchecked.
|
|
333
|
+
- Neither side providing Modules is a load error (with a hint to enable the
|
|
334
|
+
Settings row or add a note path); neither side providing an ELF simply
|
|
335
|
+
skips layout verification.
|
|
336
|
+
- Reload re-reads the note from disk, so editing it takes effect without
|
|
337
|
+
re-picking the pipeline file — but a reload never flips a checkbox.
|
|
302
338
|
|
|
303
339
|
### Stage block
|
|
304
340
|
|
|
@@ -329,7 +365,7 @@ class MyWindow(QtWidgets.QMainWindow):
|
|
|
329
365
|
def __init__(self):
|
|
330
366
|
super().__init__()
|
|
331
367
|
editor = StructEditor()
|
|
332
|
-
editor.set_sources(
|
|
368
|
+
editor.set_sources(flow_file="abc.json", cfg_dir="cfg_t")
|
|
333
369
|
self.setCentralWidget(editor)
|
|
334
370
|
```
|
|
335
371
|
|
|
@@ -354,21 +390,27 @@ Omitting an argument leaves that slot untouched.
|
|
|
354
390
|
|
|
355
391
|
```python
|
|
356
392
|
editor.set_sources(
|
|
357
|
-
cfg_dir="cfg_t", # modules dir: *.json with struct/enum/typedef defs
|
|
358
393
|
flow_file="abc.json", # pipeline definition file
|
|
394
|
+
cfg_dir="cfg_t", # modules dir: *.json with struct/enum/typedef defs
|
|
359
395
|
elf_file="fw.elf", # optional ELF for .bin layout verification
|
|
360
396
|
)
|
|
361
397
|
```
|
|
362
398
|
|
|
363
399
|
| `set_sources` argument | Description |
|
|
364
400
|
| --- | --- |
|
|
365
|
-
| `cfg_dir` | Modules directory holding `*.json` (struct / enum / typedef definitions) |
|
|
366
401
|
| `flow_file` | Path to the pipeline JSON file (pipeline definition) |
|
|
402
|
+
| `cfg_dir` | Modules directory holding `*.json` (struct / enum / typedef definitions); setting it checks the Modules row |
|
|
403
|
+
| `modules_enabled` | Override the Modules row's checkbox state, independent of whether a path is set |
|
|
367
404
|
| `elf_file` | Path to an ELF for `.bin` layout verification; setting it enables verification (toggle later via the Settings checkbox, which keeps the path) |
|
|
368
405
|
| `elf_enabled` | Override whether ELF verification runs, independent of whether a path is set |
|
|
369
406
|
| `reload` | Rebuild schema / flow / UI from the new sources, defaults to `True` |
|
|
370
407
|
| `async_load` | Run that reload on a background thread (defaults to `False`). See [Async Loading](#async-loading) |
|
|
371
408
|
|
|
409
|
+
Explicitly passed paths and checkbox states are applied after the pipeline
|
|
410
|
+
note's overrides, so they always win: a note can only uncheck a row that this
|
|
411
|
+
call left untouched. See [Source overrides via `note`](#source-overrides-via-note)
|
|
412
|
+
for the full priority rules.
|
|
413
|
+
|
|
372
414
|
Toolbar orientation is set with `set_flow_orientation('horizontal' | 'vertical')`.
|
|
373
415
|
|
|
374
416
|
#### Async Loading
|
|
@@ -387,8 +429,8 @@ older one.
|
|
|
387
429
|
```python
|
|
388
430
|
editor.show()
|
|
389
431
|
editor.set_sources(
|
|
390
|
-
cfg_dir="cfg_t",
|
|
391
432
|
flow_file="abc.json",
|
|
433
|
+
cfg_dir="cfg_t",
|
|
392
434
|
elf_file="fw.elf",
|
|
393
435
|
async_load=True, # parse off the GUI thread; window stays responsive
|
|
394
436
|
)
|
|
@@ -403,7 +445,7 @@ which side they sit on (once, via the `custom_button_position` constructor arg).
|
|
|
403
445
|
|
|
404
446
|
```python
|
|
405
447
|
editor = StructEditor(custom_button_position="end")
|
|
406
|
-
editor.set_sources(
|
|
448
|
+
editor.set_sources(flow_file="abc.json", cfg_dir="cfg_t")
|
|
407
449
|
|
|
408
450
|
def on_send():
|
|
409
451
|
print(editor.current_values())
|
|
@@ -433,7 +475,7 @@ from code (e.g. wired to a custom button):
|
|
|
433
475
|
|
|
434
476
|
| Method | Description |
|
|
435
477
|
| --- | --- |
|
|
436
|
-
| `set_sources(cfg_dir=None,
|
|
478
|
+
| `set_sources(flow_file=None, cfg_dir=None, modules_enabled=None, elf_file=None, elf_enabled=None, reload=True, async_load=False)` | Point the editor at its source files after construction. See [Setting Sources](#setting-sources). |
|
|
437
479
|
| `set_flow_orientation(orientation)` | Switch the flow-button strip between `'horizontal'` (top, default) and `'vertical'` (left). Rebuilds the strip and keeps the active stage selected. |
|
|
438
480
|
| `show_section(label) -> None` | Open the stage/section named `label` in the content area (the same as clicking its flow button). Paints the error panel instead when that stage has pipeline errors; clears the content when the label is unknown. |
|
|
439
481
|
| `current_values() -> dict` | Live editor values of the active section, keyed by field name (empty dict when no parameter section is shown). |
|
|
@@ -10,6 +10,7 @@ Render C structs / JSON schemas as an **editable PySide6 UI**, and convert freel
|
|
|
10
10
|
- **Read bin back**: `import_bin` loads a raw `.bin` (e.g. read back from the chip) into the UI — the byte-for-byte inverse of the binary export.
|
|
11
11
|
- **Validation**: keyword spell-checking (with “Did you mean X?” hints), semantic audits (`min<=max`, `step>0`), and pipeline cross-validation.
|
|
12
12
|
- **ELF layout check**: optionally verify each module — and the whole pipeline against its SDK container struct — against a compiled ELF's DWARF layout, catching offset/size drift and wrong stage order.
|
|
13
|
+
- **Pipeline note sources**: a pipeline file can pin its own Modules / ELF paths (`note` → `"Modules"` / `"ELF"`) — picking one file switches the whole setup, while the UI-picked paths keep the highest priority.
|
|
13
14
|
- **Qt-binding agnostic**: built on [Qt.py](https://github.com/mottosso/Qt.py) — works with PySide6 / PyQt6 / PySide2 / PyQt5.
|
|
14
15
|
|
|
15
16
|
## Installation
|
|
@@ -38,8 +39,8 @@ app = QtWidgets.QApplication([])
|
|
|
38
39
|
|
|
39
40
|
editor = StructEditor()
|
|
40
41
|
editor.set_sources(
|
|
41
|
-
cfg_dir="cfg_t", # modules dir: *.json holding struct/enum/typedef
|
|
42
42
|
flow_file="abc.json", # pipeline definition file
|
|
43
|
+
cfg_dir="cfg_t", # modules dir: *.json holding struct/enum/typedef
|
|
43
44
|
)
|
|
44
45
|
editor.resize(480, 600)
|
|
45
46
|
editor.show()
|
|
@@ -212,6 +213,9 @@ Loading runs three layers of checks, surfaced in the **load report** panel:
|
|
|
212
213
|
bounds, default is one of the choices.
|
|
213
214
|
- **Pipeline cross-validation** — values in the pipeline file are checked
|
|
214
215
|
against the schema (range, choices, enum membership).
|
|
216
|
+
- **Duplicate type definitions** — the same struct / enum / union defined in
|
|
217
|
+
two module files is an error; the first definition found wins and the
|
|
218
|
+
duplicate is reported.
|
|
215
219
|
|
|
216
220
|
## Pipeline File
|
|
217
221
|
|
|
@@ -224,7 +228,8 @@ tuning name) whose value is the group body:
|
|
|
224
228
|
```jsonc
|
|
225
229
|
{
|
|
226
230
|
"Speech Tuning": {
|
|
227
|
-
"
|
|
231
|
+
"note": { "Modules": "cfg_t", "ELF": "../elf/fw.elf" }, // optional sources
|
|
232
|
+
"flow": ["RX NS", "RX DRC", "RX EQ"], // stage order, optional
|
|
228
233
|
"container": "SpeechConfig", // optional, enables layout check
|
|
229
234
|
|
|
230
235
|
"RX NS": { "type": "SpeechNs2FloatConfig", "items": { /* values */ } },
|
|
@@ -238,14 +243,45 @@ tuning name) whose value is the group body:
|
|
|
238
243
|
|
|
239
244
|
| Key | Required | Notes |
|
|
240
245
|
| --- | --- | --- |
|
|
241
|
-
| `flow` |
|
|
246
|
+
| `flow` | no | Ordered list of stage names. The flow buttons and the export order follow it. **Omit it and the stages run in the order they appear in the JSON.** When present, every listed name must have a stage block; defined stages missing from `flow` are a warning. |
|
|
242
247
|
| `container` | no | Name of the SDK struct that holds all modules (see [Container layout check](#container-layout-check)). Omit to disable that check. |
|
|
248
|
+
| `note` | no | Free-form metadata dict. Two keys are special — `"Modules"` / `"ELF"` pin the pipeline's companion sources (see [Source overrides via `note`](#source-overrides-via-note)); everything else in it is ignored. |
|
|
243
249
|
| *stage name* | — | Any other key is a **stage block**; its name is the label shown on the flow button. |
|
|
244
250
|
|
|
245
251
|
All keys are **lowercase and case-sensitive** — write `flow`, not `Flow`. A
|
|
246
252
|
mistyped key (`Flow`, `flwo`, …) is reported with a "Did you mean `flow`?" hint.
|
|
247
|
-
Free-form metadata keys (`version`, `description`, `author`, `comment
|
|
248
|
-
|
|
253
|
+
Free-form metadata keys (`version`, `description`, `author`, `comment`) are
|
|
254
|
+
allowed and ignored.
|
|
255
|
+
|
|
256
|
+
### Source overrides via `note`
|
|
257
|
+
|
|
258
|
+
A pipeline file can pin its own companion sources, so picking **one file
|
|
259
|
+
switches the whole tuning setup** — no need to re-pick the Modules directory
|
|
260
|
+
and ELF by hand:
|
|
261
|
+
|
|
262
|
+
```jsonc
|
|
263
|
+
"note": {
|
|
264
|
+
"Send Format": "Speech Tuning", // free-form fields stay ignored
|
|
265
|
+
"Modules": "cfg_t", // modules directory
|
|
266
|
+
"ELF": "../elf/best1702_ibrt.elf" // ELF for layout verification
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Both keys are optional and take absolute or **pipeline-file-relative** paths.
|
|
271
|
+
Selecting the pipeline applies them in Settings:
|
|
272
|
+
|
|
273
|
+
- The matching row's checkbox is **unchecked** — exactly as if the user had —
|
|
274
|
+
and the note's path feeds the slot. The checkbox stays clickable and the
|
|
275
|
+
UI-picked path is kept and still displayed, so re-checking the row switches
|
|
276
|
+
back to it at any time.
|
|
277
|
+
- **UI settings always win**: a checked row forces the UI-picked path no
|
|
278
|
+
matter what the note says. The note can only take over a row the user left
|
|
279
|
+
unchecked.
|
|
280
|
+
- Neither side providing Modules is a load error (with a hint to enable the
|
|
281
|
+
Settings row or add a note path); neither side providing an ELF simply
|
|
282
|
+
skips layout verification.
|
|
283
|
+
- Reload re-reads the note from disk, so editing it takes effect without
|
|
284
|
+
re-picking the pipeline file — but a reload never flips a checkbox.
|
|
249
285
|
|
|
250
286
|
### Stage block
|
|
251
287
|
|
|
@@ -276,7 +312,7 @@ class MyWindow(QtWidgets.QMainWindow):
|
|
|
276
312
|
def __init__(self):
|
|
277
313
|
super().__init__()
|
|
278
314
|
editor = StructEditor()
|
|
279
|
-
editor.set_sources(
|
|
315
|
+
editor.set_sources(flow_file="abc.json", cfg_dir="cfg_t")
|
|
280
316
|
self.setCentralWidget(editor)
|
|
281
317
|
```
|
|
282
318
|
|
|
@@ -301,21 +337,27 @@ Omitting an argument leaves that slot untouched.
|
|
|
301
337
|
|
|
302
338
|
```python
|
|
303
339
|
editor.set_sources(
|
|
304
|
-
cfg_dir="cfg_t", # modules dir: *.json with struct/enum/typedef defs
|
|
305
340
|
flow_file="abc.json", # pipeline definition file
|
|
341
|
+
cfg_dir="cfg_t", # modules dir: *.json with struct/enum/typedef defs
|
|
306
342
|
elf_file="fw.elf", # optional ELF for .bin layout verification
|
|
307
343
|
)
|
|
308
344
|
```
|
|
309
345
|
|
|
310
346
|
| `set_sources` argument | Description |
|
|
311
347
|
| --- | --- |
|
|
312
|
-
| `cfg_dir` | Modules directory holding `*.json` (struct / enum / typedef definitions) |
|
|
313
348
|
| `flow_file` | Path to the pipeline JSON file (pipeline definition) |
|
|
349
|
+
| `cfg_dir` | Modules directory holding `*.json` (struct / enum / typedef definitions); setting it checks the Modules row |
|
|
350
|
+
| `modules_enabled` | Override the Modules row's checkbox state, independent of whether a path is set |
|
|
314
351
|
| `elf_file` | Path to an ELF for `.bin` layout verification; setting it enables verification (toggle later via the Settings checkbox, which keeps the path) |
|
|
315
352
|
| `elf_enabled` | Override whether ELF verification runs, independent of whether a path is set |
|
|
316
353
|
| `reload` | Rebuild schema / flow / UI from the new sources, defaults to `True` |
|
|
317
354
|
| `async_load` | Run that reload on a background thread (defaults to `False`). See [Async Loading](#async-loading) |
|
|
318
355
|
|
|
356
|
+
Explicitly passed paths and checkbox states are applied after the pipeline
|
|
357
|
+
note's overrides, so they always win: a note can only uncheck a row that this
|
|
358
|
+
call left untouched. See [Source overrides via `note`](#source-overrides-via-note)
|
|
359
|
+
for the full priority rules.
|
|
360
|
+
|
|
319
361
|
Toolbar orientation is set with `set_flow_orientation('horizontal' | 'vertical')`.
|
|
320
362
|
|
|
321
363
|
#### Async Loading
|
|
@@ -334,8 +376,8 @@ older one.
|
|
|
334
376
|
```python
|
|
335
377
|
editor.show()
|
|
336
378
|
editor.set_sources(
|
|
337
|
-
cfg_dir="cfg_t",
|
|
338
379
|
flow_file="abc.json",
|
|
380
|
+
cfg_dir="cfg_t",
|
|
339
381
|
elf_file="fw.elf",
|
|
340
382
|
async_load=True, # parse off the GUI thread; window stays responsive
|
|
341
383
|
)
|
|
@@ -350,7 +392,7 @@ which side they sit on (once, via the `custom_button_position` constructor arg).
|
|
|
350
392
|
|
|
351
393
|
```python
|
|
352
394
|
editor = StructEditor(custom_button_position="end")
|
|
353
|
-
editor.set_sources(
|
|
395
|
+
editor.set_sources(flow_file="abc.json", cfg_dir="cfg_t")
|
|
354
396
|
|
|
355
397
|
def on_send():
|
|
356
398
|
print(editor.current_values())
|
|
@@ -380,7 +422,7 @@ from code (e.g. wired to a custom button):
|
|
|
380
422
|
|
|
381
423
|
| Method | Description |
|
|
382
424
|
| --- | --- |
|
|
383
|
-
| `set_sources(cfg_dir=None,
|
|
425
|
+
| `set_sources(flow_file=None, cfg_dir=None, modules_enabled=None, elf_file=None, elf_enabled=None, reload=True, async_load=False)` | Point the editor at its source files after construction. See [Setting Sources](#setting-sources). |
|
|
384
426
|
| `set_flow_orientation(orientation)` | Switch the flow-button strip between `'horizontal'` (top, default) and `'vertical'` (left). Rebuilds the strip and keeps the active stage selected. |
|
|
385
427
|
| `show_section(label) -> None` | Open the stage/section named `label` in the content area (the same as clicking its flow button). Paints the error panel instead when that stage has pipeline errors; clears the content when the label is unknown. |
|
|
386
428
|
| `current_values() -> dict` | Live editor values of the active section, keyed by field name (empty dict when no parameter section is shown). |
|