https://github.com/agoose77/qt-jsonschema-form

Qt JSON Schema form generator

https://github.com/agoose77/qt-jsonschema-form

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.9%) to scientific vocabulary

Keywords

editor form jsonschema python schema ui-generator
Last synced: 5 months ago · JSON representation

Repository

Qt JSON Schema form generator

Basic Info
  • Host: GitHub
  • Owner: agoose77
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 20.5 KB
Statistics
  • Stars: 21
  • Watchers: 5
  • Forks: 16
  • Open Issues: 2
  • Releases: 0
Topics
editor form jsonschema python schema ui-generator
Created over 7 years ago · Last pushed about 3 years ago
Metadata Files
Readme License

README.md

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

```python3 import sys from json import dumps

from qtpy import QtWidgets

from qtjsonschemaform 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.

Owner

  • Name: Angus Hollands
  • Login: agoose77
  • Kind: user
  • Location: United Kingdom
  • Company: 2i2c

Open Source Infrastructure Engineer @ 2i2c. Executable Books core team member. PhD in Nuclear Physics from the University of Birmingham.

GitHub Events

Total
  • Watch event: 1
  • Fork event: 1
Last Year
  • Watch event: 1
  • Fork event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 14
  • Total Committers: 2
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.071
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Angus Hollands g****5@g****m 13
Jacob Williams j****s 1

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 3
  • Total pull requests: 2
  • Average time to close issues: about 5 hours
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 1.0
  • Average comments per pull request: 7.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jacobwilliams (2)
  • artinthetrees (1)
Pull Request Authors
  • Arthur-Milchior (1)
  • jacobwilliams (1)
Top Labels
Issue Labels
Pull Request Labels