struct2ui 0.1.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.
- struct2ui/__init__.py +4 -0
- struct2ui/editor.py +1171 -0
- struct2ui/exporters/__init__.py +15 -0
- struct2ui/exporters/bin_emitter.py +254 -0
- struct2ui/exporters/c_emitter.py +233 -0
- struct2ui/exporters/c_parser.py +204 -0
- struct2ui/exporters/elf_verifier.py +341 -0
- struct2ui/exporters/json_format.py +137 -0
- struct2ui/icons/c2j.png +0 -0
- struct2ui/icons/elf.png +0 -0
- struct2ui/icons/export_notes_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/flowchart_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/refresh_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/report_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/save_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/save_as_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/settings_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/icons/widgets_24dp_000000_FILL0_wght400_GRAD0_opsz24.png +0 -0
- struct2ui/schema.py +1118 -0
- struct2ui/ui/__init__.py +36 -0
- struct2ui/ui/renderers.py +304 -0
- struct2ui/ui/tables.py +207 -0
- struct2ui/ui/widgets.py +907 -0
- struct2ui-0.1.0.dist-info/METADATA +167 -0
- struct2ui-0.1.0.dist-info/RECORD +28 -0
- struct2ui-0.1.0.dist-info/WHEEL +5 -0
- struct2ui-0.1.0.dist-info/licenses/LICENSE +21 -0
- struct2ui-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: struct2ui
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Render C struct / JSON schema as editable PySide6 UI, export to C/JSON/bin
|
|
5
|
+
Author: Jay
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Jay
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Keywords: qt,pyside6,gui,c-struct,json-schema,code-generation,parameter-tuning
|
|
29
|
+
Classifier: Development Status :: 3 - Alpha
|
|
30
|
+
Classifier: Intended Audience :: Developers
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
37
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
38
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
39
|
+
Requires-Python: >=3.9
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Requires-Dist: Qt.py>=1.3
|
|
43
|
+
Provides-Extra: pyside6
|
|
44
|
+
Requires-Dist: PySide6>=6.4; extra == "pyside6"
|
|
45
|
+
Provides-Extra: pyqt6
|
|
46
|
+
Requires-Dist: PyQt6>=6.4; extra == "pyqt6"
|
|
47
|
+
Provides-Extra: elf
|
|
48
|
+
Requires-Dist: pyelftools>=0.29; extra == "elf"
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
51
|
+
Requires-Dist: pyelftools>=0.29; extra == "dev"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
# struct2ui
|
|
55
|
+
|
|
56
|
+
Render C structs / JSON schemas as an **editable PySide6 UI**, and convert freely between **C / JSON / bin**. Built for algorithm parameter tuning: describe a C interface in JSON, auto-generate a Qt form, edit it, then export back to C source, JSON, or binary.
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
- **JSON → UI**: describe C structs / enums / arrays with minimal JSON and auto-render Qt widgets (int→QSpinBox, float→QDoubleSpinBox, enum→QComboBox, etc.).
|
|
61
|
+
- **Embeddable**: `StructEditor` is a plain `QWidget` that drops into any PySide6 / PyQt UI.
|
|
62
|
+
- **Multi-format export**: edited results export to C source, JSON, or binary; C source can also be parsed back into a schema.
|
|
63
|
+
- **Validation**: keyword spell-checking (with “Did you mean X?” hints), semantic audits (`min<=max`, `step>0`), and pipeline cross-validation.
|
|
64
|
+
- **Qt-binding agnostic**: built on [Qt.py](https://github.com/mottosso/Qt.py) — works with PySide6 / PyQt6 / PySide2 / PyQt5.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install struct2ui
|
|
70
|
+
|
|
71
|
+
# Pick a Qt binding (choose one)
|
|
72
|
+
pip install "struct2ui[pyside6]"
|
|
73
|
+
pip install "struct2ui[pyqt6]"
|
|
74
|
+
|
|
75
|
+
# Enable ELF layout verification (optional)
|
|
76
|
+
pip install "struct2ui[elf]"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> The library itself only depends on `Qt.py`; you must install a Qt binding (PySide6 / PyQt6 / etc.) yourself.
|
|
80
|
+
> ELF verification depends on `pyelftools`, installed via the `[elf]` extra.
|
|
81
|
+
|
|
82
|
+
## Quick Start
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from Qt import QtWidgets
|
|
86
|
+
from struct2ui import StructEditor
|
|
87
|
+
|
|
88
|
+
app = QtWidgets.QApplication([])
|
|
89
|
+
|
|
90
|
+
editor = StructEditor(
|
|
91
|
+
flow_file="abc.json", # pipeline definition file
|
|
92
|
+
cfg_dir="cfg_t", # modules dir: *.json holding struct/enum/typedef
|
|
93
|
+
)
|
|
94
|
+
editor.resize(480, 600)
|
|
95
|
+
editor.show()
|
|
96
|
+
|
|
97
|
+
app.exec_()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Embedding into an Existing UI
|
|
101
|
+
|
|
102
|
+
`StructEditor` is a regular `QWidget`; just put it into a layout:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from Qt import QtWidgets
|
|
106
|
+
from struct2ui import StructEditor
|
|
107
|
+
|
|
108
|
+
class MyWindow(QtWidgets.QMainWindow):
|
|
109
|
+
def __init__(self):
|
|
110
|
+
super().__init__()
|
|
111
|
+
editor = StructEditor(
|
|
112
|
+
"abc.json", "cfg_t",
|
|
113
|
+
settings_org="MyCompany", # custom QSettings scope to
|
|
114
|
+
settings_app="MyApp", # avoid clashing with the host app
|
|
115
|
+
)
|
|
116
|
+
self.setCentralWidget(editor)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Constructor Parameters
|
|
120
|
+
|
|
121
|
+
| Parameter | Description |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `flow_file` | Path to the pipeline JSON file (pipeline definition) |
|
|
124
|
+
| `cfg_dir` | Modules directory holding `*.json` (struct / enum / typedef definitions) |
|
|
125
|
+
| `parent` | Qt parent object, defaults to `None` |
|
|
126
|
+
| `appearance` | Button appearance overrides, `{key: {'mode': ..., 'icon': ..., 'text': ...}}` |
|
|
127
|
+
| `settings_org` | QSettings organization name, defaults to `'struct2ui'` |
|
|
128
|
+
| `settings_app` | QSettings application name, defaults to `'StructEditor'` |
|
|
129
|
+
|
|
130
|
+
## Export API
|
|
131
|
+
|
|
132
|
+
The low-level export functions can be used standalone, without any UI:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from struct2ui.schema import SchemaRegistry
|
|
136
|
+
from struct2ui.exporters import (
|
|
137
|
+
emit_c, # sections + registry -> C source string
|
|
138
|
+
dumps_json, # -> JSON string
|
|
139
|
+
emit_bin, # -> binary bytes
|
|
140
|
+
merge_abi, # merge ABI info
|
|
141
|
+
verify_sections, # verify .bin layout against an ELF
|
|
142
|
+
parse_c_source, # C source -> parse result
|
|
143
|
+
build_schema_dict,
|
|
144
|
+
)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Architecture
|
|
148
|
+
|
|
149
|
+
| Layer | Module | Responsibility |
|
|
150
|
+
| --- | --- | --- |
|
|
151
|
+
| Schema (pure data, no Qt) | `struct2ui.schema` | Parse `*.json` into a Field tree; spell-checking, semantic audits, pipeline cross-validation |
|
|
152
|
+
| UI rendering | `struct2ui.ui` | `WidgetFactory`, `FormRenderer`/`TreeRenderer`, array tables, `when` conditional binding |
|
|
153
|
+
| Export | `struct2ui.exporters` | C / JSON / bin export, C source reverse parsing, ELF verification |
|
|
154
|
+
| Top-level widget | `struct2ui.StructEditor` | Path bar / action buttons / content area; load report panel; QSettings path memory |
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pip install -e ".[dev]" --no-build-isolation
|
|
160
|
+
python -m pytest
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Tests live under `tests/` and drive real Qt widgets headlessly on the offscreen platform.
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
[MIT](LICENSE) © Jay
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
struct2ui/__init__.py,sha256=3t4b6VmTwxeqbnWytq0NPHvLbR30NwdBiMEDCscvr84,87
|
|
2
|
+
struct2ui/editor.py,sha256=A0gmb_1ZGXZelKlkiPCLiS_HUFEE7mIKwLPqu9iKegA,51784
|
|
3
|
+
struct2ui/schema.py,sha256=y-yBjVgEaxSBV-Fxh6et_DFlwunbY9YI-xXFlt5JtMo,48147
|
|
4
|
+
struct2ui/exporters/__init__.py,sha256=-nUwPMHej6yLIjF0paAZNZcul9YwYEZyfccH9H7XqzE,549
|
|
5
|
+
struct2ui/exporters/bin_emitter.py,sha256=z_YIy5FFfa83Blz06PL39A6oNScgz1DHW1T0De2wobY,8904
|
|
6
|
+
struct2ui/exporters/c_emitter.py,sha256=4Y7ADJKzrfduxZYTb5CmzuFhuUaVNDcmU_1q2Z0NI-4,8673
|
|
7
|
+
struct2ui/exporters/c_parser.py,sha256=AJCFqnM14lP-7p8g199BWW146j5iX6eBhnWXn1Sg6GE,7574
|
|
8
|
+
struct2ui/exporters/elf_verifier.py,sha256=JNc7DfeQbLJi2UJyNQ2xBGOIt_fkp6DNH6-lAp66xZ8,12335
|
|
9
|
+
struct2ui/exporters/json_format.py,sha256=ihj4KnNSLJZllOq2zqzloXnmPsqhnK8ewsoDPRDTTHc,5059
|
|
10
|
+
struct2ui/icons/c2j.png,sha256=azwc6sM78mdZJ_gcrgk8oePCtpFWsISZ50abkUi_X68,481
|
|
11
|
+
struct2ui/icons/elf.png,sha256=6yrLbPj0Z2XXTXqRyBLSg9lM78-ud9aYOEPET0gNq1Q,374
|
|
12
|
+
struct2ui/icons/export_notes_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=jizQPZ1gGXHihaMC_nwQRXeym_k1I8c6uZ0je9tOlf0,413
|
|
13
|
+
struct2ui/icons/flowchart_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=zdCiQRKt_BV37pyngGQB75dt260n1lIahvbVVY5LU58,261
|
|
14
|
+
struct2ui/icons/refresh_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=Vv4NVcTzuxT2GeQQLMuh2VhiNEPJCcA4GxJgX8mrLuw,408
|
|
15
|
+
struct2ui/icons/report_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=nl6PjyDBPp1IMKPdocv8OQ434y1_Pc3RHaSMu9oip5c,327
|
|
16
|
+
struct2ui/icons/save_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=-PmzLVVverpZMgXBc0kOb5WzZpxL--1ueraL6y0prlg,312
|
|
17
|
+
struct2ui/icons/save_as_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=uY9mFM0FRukTqgpZlnfVa9q8Gn9la_yNzPNZMqaokCc,401
|
|
18
|
+
struct2ui/icons/settings_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=oaEBh8cKo6hzH9b_rcjIPDBi2W1GBRnikPxqWS8Q8PQ,577
|
|
19
|
+
struct2ui/icons/widgets_24dp_000000_FILL0_wght400_GRAD0_opsz24.png,sha256=rgynhq4ud7FCjChDwhamYeJehDQh8sDpl6bIoUownGk,356
|
|
20
|
+
struct2ui/ui/__init__.py,sha256=d0Kb8qmDj5MYXygSZBhHZ76yIw-1GwRtpyEJ2hs6xTQ,1036
|
|
21
|
+
struct2ui/ui/renderers.py,sha256=m87uhdY2Y3JCIxo5OMBCBCgsbdPRy0RXc46OgnR5GO0,13541
|
|
22
|
+
struct2ui/ui/tables.py,sha256=zzhaNS7ZK7bfOuOOiH1eGBTPJwURqsvjpQR8TCC65KU,8549
|
|
23
|
+
struct2ui/ui/widgets.py,sha256=k97NOx4xPYxR42rF8ntwerpR7r1y1Eweu_pOyJA3DkU,33964
|
|
24
|
+
struct2ui-0.1.0.dist-info/licenses/LICENSE,sha256=xEsRvzJ-7Nbqa9ppe87ZOX9Xgmc2CJ7HOEFGRa0rcpU,1060
|
|
25
|
+
struct2ui-0.1.0.dist-info/METADATA,sha256=5Xv6S8QaSK0kYoKM8_UiKaHDcRSuAaivyzKuzXTUaCU,6634
|
|
26
|
+
struct2ui-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
27
|
+
struct2ui-0.1.0.dist-info/top_level.txt,sha256=5VSACaV9oM-KVn5zhiEnmO9YmzjfgTmpaRF1-8ylHk0,10
|
|
28
|
+
struct2ui-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
struct2ui
|