struct2ui 0.6.0__tar.gz → 0.7.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.
Files changed (50) hide show
  1. {struct2ui-0.6.0/src/struct2ui.egg-info → struct2ui-0.7.0}/PKG-INFO +27 -14
  2. {struct2ui-0.6.0 → struct2ui-0.7.0}/README.md +26 -13
  3. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/__init__.py +1 -1
  4. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/editor.py +2110 -2107
  5. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/c_emitter.py +304 -292
  6. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/schema.py +7 -116
  7. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/ui/renderers.py +366 -333
  8. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/ui/tables.py +189 -69
  9. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/ui/widgets.py +1116 -1155
  10. {struct2ui-0.6.0 → struct2ui-0.7.0/src/struct2ui.egg-info}/PKG-INFO +27 -14
  11. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_editor.py +615 -615
  12. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_union.py +107 -65
  13. {struct2ui-0.6.0 → struct2ui-0.7.0}/LICENSE +0 -0
  14. {struct2ui-0.6.0 → struct2ui-0.7.0}/pyproject.toml +0 -0
  15. {struct2ui-0.6.0 → struct2ui-0.7.0}/setup.cfg +0 -0
  16. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/__init__.py +0 -0
  17. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/bin_emitter.py +0 -0
  18. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/bin_reader.py +0 -0
  19. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/c_parser.py +0 -0
  20. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/elf_verifier.py +0 -0
  21. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/exporters/json_format.py +0 -0
  22. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/c2j.png +0 -0
  23. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/elf.png +0 -0
  24. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/export_notes_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  25. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/flowchart_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  26. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/refresh_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  27. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/report_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  28. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/save_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  29. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/save_as_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  30. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/settings_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  31. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/icons/widgets_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
  32. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui/ui/__init__.py +0 -0
  33. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui.egg-info/SOURCES.txt +0 -0
  34. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui.egg-info/dependency_links.txt +0 -0
  35. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui.egg-info/requires.txt +0 -0
  36. {struct2ui-0.6.0 → struct2ui-0.7.0}/src/struct2ui.egg-info/top_level.txt +0 -0
  37. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_bin_emitter.py +0 -0
  38. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_bin_reader.py +0 -0
  39. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_c_emitter.py +0 -0
  40. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_c_parser.py +0 -0
  41. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_choices.py +0 -0
  42. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_container_verify.py +0 -0
  43. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_elf_verifier.py +0 -0
  44. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_float_precision.py +0 -0
  45. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_int_checkbox.py +0 -0
  46. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_json_format.py +0 -0
  47. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_load_report.py +0 -0
  48. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_macro_bounds.py +0 -0
  49. {struct2ui-0.6.0 → struct2ui-0.7.0}/tests/test_save.py +0 -0
  50. {struct2ui-0.6.0 → struct2ui-0.7.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.6.0
3
+ Version: 0.7.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
@@ -144,7 +144,7 @@ generated from it. Files live in the **modules directory** (`cfg_dir`), one
144
144
  | --- | --- | --- |
145
145
  | `struct` | `type`, `items` (list of field specs) | `items` is required |
146
146
  | `enum` | `type`, `items` (object `{NAME: value}`) | reads back the enumerator name |
147
- | `union` | `type`, `items` (list of branch structs), `branch` (optional) | tagged union; each branch is an inline `struct` selected by its `when` (see below) |
147
+ | `union` | `type`, `items` (list of branch structs) | tagged union; each branch is an inline `struct` selected by its `when` (see below; a legacy `branch` key is accepted but ignored) |
148
148
  | `typedefs` | object `{alias: real_type}` | resolved before field building |
149
149
 
150
150
  Free-form metadata keys are allowed and ignored at any level: `version`,
@@ -185,7 +185,7 @@ When omitted, the widget is inferred from `type` (and from `min/max`,
185
185
  | `dial` | int | Rotary dial popup (requires `min` & `max`). |
186
186
  | `file` | array | Path label + Browse button; loads array values from a text file. |
187
187
  | `multiline` | array | Single-line shell that pops up a multi-line editor. |
188
- | `table` | struct array | Force grid layout (one column per struct member; a union member pinned via `branch` expands its branch members into columns). |
188
+ | `table` | struct array | Express grid-layout intent (one column per struct member; a union member expands the branch inferred from the pipeline rows into columns — see the union section below). |
189
189
 
190
190
  Numeric fields without an explicit `widget` become a `QSpinBox` /
191
191
  `QDoubleSpinBox`; scalar arrays become a comma-separated line edit.
@@ -218,7 +218,7 @@ match (logical AND):
218
218
  The dependency name is matched against the dotted leaf name in scope. When a
219
219
  dependency is not found, the field stays enabled.
220
220
 
221
- ### `union` (tagged union) & `branch`
221
+ ### `union` (tagged union)
222
222
 
223
223
  A `union` block declares overlapping branches, each an inline `struct` in
224
224
  `items`. At runtime the branch whose `when` matches is the one shown / exported
@@ -234,16 +234,29 @@ and unmatched exports are zero-padded.
234
234
  ] }
235
235
  ```
236
236
 
237
- Set `branch` on the union to **pin it to a single branch**: only that branch is
238
- a candidate (the others are never shown and their `when` is ignored); the pinned
239
- branch is still gated by its own `when`. Pinning to a flat (all-leaf) branch lets
240
- a struct array carrying the union render as a **table** — the branch members
241
- become columns, and a row whose discriminator makes the branch `when` false has
242
- those cells disabled (value kept, still exported zero-padded).
243
-
244
- ```jsonc
245
- { "name": "coeffs", "type": "FilterCoeffs", "branch": "design" }
246
- ```
237
+ #### Union inside a table-rendered struct array
238
+
239
+ A struct array containing a union renders as a **table** when all its rows use
240
+ the same union branch. The branch is **inferred from the pipeline data** —
241
+ nothing is pinned in the modules file (the legacy `branch` key is accepted but
242
+ silently ignored):
243
+
244
+ - **Uniform rows** → the inferred branch's members expand into columns. Two
245
+ applications can therefore share one `FilterCoeffs` and still each get a
246
+ table: one pipeline writes only `raw` rows, the other only `design` rows.
247
+ - **Mixed rows** (e.g. one `RAW` row next to `PEAKINGEQ` rows) → the array
248
+ falls back to the **tree** layout, where each row keeps its own branch.
249
+ - **No rows written** → the discriminator's schema `value` picks the branch.
250
+ - **Tail rows** (the pipeline wrote fewer rows than `count`) follow the first
251
+ written row: the discriminator continues its value (rule A) and the branch
252
+ members use their defaults.
253
+
254
+ The discriminator combos in the table are filtered down to the values that
255
+ satisfy the inferred branch's `when`, so a mixed-branch row can never be
256
+ created from the UI — there are no greyed-out cells and no zero-padded exports.
257
+ For the same reason, `widget: "table"` on a union-bearing struct array is only
258
+ an *intent*: the data still decides table vs. tree, and the column-count limit
259
+ does not apply when the intent succeeds.
247
260
 
248
261
  ### `count` expressions & multi-dimensional arrays
249
262
 
@@ -91,7 +91,7 @@ generated from it. Files live in the **modules directory** (`cfg_dir`), one
91
91
  | --- | --- | --- |
92
92
  | `struct` | `type`, `items` (list of field specs) | `items` is required |
93
93
  | `enum` | `type`, `items` (object `{NAME: value}`) | reads back the enumerator name |
94
- | `union` | `type`, `items` (list of branch structs), `branch` (optional) | tagged union; each branch is an inline `struct` selected by its `when` (see below) |
94
+ | `union` | `type`, `items` (list of branch structs) | tagged union; each branch is an inline `struct` selected by its `when` (see below; a legacy `branch` key is accepted but ignored) |
95
95
  | `typedefs` | object `{alias: real_type}` | resolved before field building |
96
96
 
97
97
  Free-form metadata keys are allowed and ignored at any level: `version`,
@@ -132,7 +132,7 @@ When omitted, the widget is inferred from `type` (and from `min/max`,
132
132
  | `dial` | int | Rotary dial popup (requires `min` & `max`). |
133
133
  | `file` | array | Path label + Browse button; loads array values from a text file. |
134
134
  | `multiline` | array | Single-line shell that pops up a multi-line editor. |
135
- | `table` | struct array | Force grid layout (one column per struct member; a union member pinned via `branch` expands its branch members into columns). |
135
+ | `table` | struct array | Express grid-layout intent (one column per struct member; a union member expands the branch inferred from the pipeline rows into columns — see the union section below). |
136
136
 
137
137
  Numeric fields without an explicit `widget` become a `QSpinBox` /
138
138
  `QDoubleSpinBox`; scalar arrays become a comma-separated line edit.
@@ -165,7 +165,7 @@ match (logical AND):
165
165
  The dependency name is matched against the dotted leaf name in scope. When a
166
166
  dependency is not found, the field stays enabled.
167
167
 
168
- ### `union` (tagged union) & `branch`
168
+ ### `union` (tagged union)
169
169
 
170
170
  A `union` block declares overlapping branches, each an inline `struct` in
171
171
  `items`. At runtime the branch whose `when` matches is the one shown / exported
@@ -181,16 +181,29 @@ and unmatched exports are zero-padded.
181
181
  ] }
182
182
  ```
183
183
 
184
- Set `branch` on the union to **pin it to a single branch**: only that branch is
185
- a candidate (the others are never shown and their `when` is ignored); the pinned
186
- branch is still gated by its own `when`. Pinning to a flat (all-leaf) branch lets
187
- a struct array carrying the union render as a **table** — the branch members
188
- become columns, and a row whose discriminator makes the branch `when` false has
189
- those cells disabled (value kept, still exported zero-padded).
190
-
191
- ```jsonc
192
- { "name": "coeffs", "type": "FilterCoeffs", "branch": "design" }
193
- ```
184
+ #### Union inside a table-rendered struct array
185
+
186
+ A struct array containing a union renders as a **table** when all its rows use
187
+ the same union branch. The branch is **inferred from the pipeline data** —
188
+ nothing is pinned in the modules file (the legacy `branch` key is accepted but
189
+ silently ignored):
190
+
191
+ - **Uniform rows** → the inferred branch's members expand into columns. Two
192
+ applications can therefore share one `FilterCoeffs` and still each get a
193
+ table: one pipeline writes only `raw` rows, the other only `design` rows.
194
+ - **Mixed rows** (e.g. one `RAW` row next to `PEAKINGEQ` rows) → the array
195
+ falls back to the **tree** layout, where each row keeps its own branch.
196
+ - **No rows written** → the discriminator's schema `value` picks the branch.
197
+ - **Tail rows** (the pipeline wrote fewer rows than `count`) follow the first
198
+ written row: the discriminator continues its value (rule A) and the branch
199
+ members use their defaults.
200
+
201
+ The discriminator combos in the table are filtered down to the values that
202
+ satisfy the inferred branch's `when`, so a mixed-branch row can never be
203
+ created from the UI — there are no greyed-out cells and no zero-padded exports.
204
+ For the same reason, `widget: "table"` on a union-bearing struct array is only
205
+ an *intent*: the data still decides table vs. tree, and the column-count limit
206
+ does not apply when the intent succeeds.
194
207
 
195
208
  ### `count` expressions & multi-dimensional arrays
196
209
 
@@ -1,4 +1,4 @@
1
1
  from .editor import StructEditor
2
2
 
3
- __version__ = "0.6.0"
3
+ __version__ = "0.7.0"
4
4
  __all__ = ["StructEditor"]