Skip to content

Commit

Permalink
remove example and redirects to test
Browse files Browse the repository at this point in the history
Example was wrong because of date
  • Loading branch information
Arthur-Milchior committed Mar 11, 2020
1 parent 37017b7 commit b715080
Showing 1 changed file with 1 addition and 86 deletions.
87 changes: 1 addition & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,89 +15,4 @@ Additionally, the `$ref` keyword is not supported. This will be fixed, but is wa
For more details about each options, see [](USAGE.md)

## Example
```python3
import sys
from json import dumps

from PyQt5 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_()


```
See (the test file)[test.py]

0 comments on commit b715080

Please sign in to comment.