qt-jsonschema-form
A tool to generate Qt forms from JSON Schemas.
Features
- Error messages from JSONSchema validation (see jsonschema).
- Widgets for file selection, colour picking, date-time selection (and more).
- Per-field widget customisation is provided by an additional ui-schema (inspired by https://github.com/mozilla-services/react-jsonschema-form).
Unsupported validators
Currently this tool does not support anyOf or oneOf directives. The reason for this is simply that these validators have different semantics depending upon the context in which they are found. Primitive support could be added with meta-widgets for type schemas.
Additionally, the $ref keyword is not supported. This will be fixed, but is waiting on some proposed upstream changes in jsonschema
Example
import sys
from json import dumps
from qtpy import QtWidgets
from qt_jsonschema_form import WidgetBuilder
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
builder = WidgetBuilder()
schema = {
"type": "object",
"title": "Number fields and widgets",
"properties": {
"schema_path": {
"title": "Schema path",
"type": "string"
},
"integerRangeSteps": {
"title": "Integer range (by 10)",
"type": "integer",
"minimum": 55,
"maximum": 100,
"multipleOf": 10
},
"event": {
"type": "string",
"format": "date"
},
"sky_colour": {
"type": "string"
},
"names": {
"type": "array",
"items": [
{
"type": "string",
"pattern": "[a-zA-Z\-'\s]+",
"enum": [
"Jack", "Jill"
]
},
{
"type": "string",
"pattern": "[a-zA-Z\-'\s]+",
"enum": [
"Alice", "Bob"
]
},
],
"additionalItems": {
"type": "number"
},
}
}
}
ui_schema = {
"schema_path": {
"ui:widget": "filepath"
},
"sky_colour": {
"ui:widget": "colour"
}
}
form = builder.create_form(schema, ui_schema)
form.widget.state = {
"schema_path": "some_file.py",
"integerRangeSteps": 60,
"sky_colour": "#8f5902",
"names": [
"Jack",
"Bob"
]
}
form.show()
form.widget.on_changed.connect(lambda d: print(dumps(d, indent=4)))
app.exec_()
Notes
This package uses QtPy as an abstraction layer for PyQt5/PySide2/PyQt6/PySide6. One of those libraries must also be installed in order to function.
Metadata
Release files for qt-jsonschema-form 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qt_jsonschema_form-1.0.0.tar.gz | 240.6 kB | Without provenance | Details for qt_jsonschema_form-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qt_jsonschema_form-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for qt_jsonschema_form-1.0.0-py3-none-any.whl |
Total release size: 250.1 kB
Release files / qt_jsonschema_form-1.0.0.tar.gz
| Download URL | qt_jsonschema_form-1.0.0.tar.gz |
|---|---|
| Size | 240.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f480f0087364f42967716fe598b6c1acbbc94a148247040292a0242b760cc5c6
|
|
BLAKE2b-256 checksum How to use checksums |
4c0abff9f18ff472eebafa8bcbbad33e52dedd2557b0200a64542a17f894d9a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / qt_jsonschema_form-1.0.0-py3-none-any.whl
| Download URL | qt_jsonschema_form-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a49600c5df41ee03bb1e811f8b23049615ca86f50e63c67e2304dc488a51f6b
|
|
BLAKE2b-256 checksum How to use checksums |
8b7ee0e7b87c482a789cc37f44d6da8fd6d9c9655fe367cd5e08a4d8a9e3006f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for qt-jsonschema-form 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.