Skip to content

Commit 78d0134

Browse files
committed
Commit
0 parents  commit 78d0134

File tree

7 files changed

+1824
-0
lines changed

7 files changed

+1824
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv/*
2+
__pycache__/*

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<p align="center">
2+
<img src="https://user-images.githubusercontent.com/0000000/0000000-kore-logo.png" alt="KoreUI Logo" height="120" />
3+
</p>
4+
5+
<h1 align="center">KoreUI</h1>
6+
7+
<p align="center">
8+
<strong>Dynamic GUI Generator from JSON Schema</strong><br />
9+
Build fully-functional PySide6 interfaces from JSON Schema — including complex features like <code>if/then/else</code>, <code>allOf</code>, dynamic arrays, and real-time validation.
10+
</p>
11+
12+
---
13+
14+
## 🚀 Features
15+
16+
- 📄 Full support for JSON Schema Draft 2020-12
17+
- 🧩 Handles `if` / `then` / `else`, `allOf`, `anyOf`, `oneOf`, `$ref`, and more
18+
- 🧠 Live conditionals — forms change in real-time based on inputs
19+
- 🛠️ Built-in validation with contextual error messages
20+
- 🧼 Modern, dark-themed UI with PySide6
21+
- 🧪 Ideal for form builders, config tools, admin panels, or low-code platforms
22+
23+
---
24+
25+
## 📦 Installation
26+
27+
Run the following:
28+
29+
pip install -r requirements.txt
30+
31+
Requirements:
32+
33+
- Python 3.8+
34+
- PySide6
35+
36+
---
37+
38+
## 🧑‍💻 Usage
39+
40+
To start the application:
41+
42+
python app.py
43+
44+
Edit the `schema.json` file to customize your form structure.
45+
46+
---
47+
48+
## 🧪 Example Schema
49+
50+
{
51+
"type": "object",
52+
"properties": {
53+
"mode": {
54+
"type": "string",
55+
"enum": ["simple", "advanced"]
56+
},
57+
"settings": {
58+
"if": {
59+
"properties": { "mode": { "const": "advanced" } }
60+
},
61+
"then": {
62+
"properties": { "threshold": { "type": "number" } }
63+
},
64+
"else": {
65+
"properties": { "notes": { "type": "string" } }
66+
},
67+
"type": "object"
68+
}
69+
}
70+
}
71+
72+
---
73+
74+
## 📸 Screenshot
75+
76+
*(Optional: include a screenshot of a rendered form here)*
77+
78+
---
79+
80+
## 🧱 Architecture
81+
82+
- `koreui.py` – Core schema resolver, validator, and widget logic
83+
- `app.py` – App entry point
84+
- `schema.json` – Example JSON Schema used to render a dynamic form
85+
86+
---
87+
88+
## 🧩 Logo
89+
90+
Replace the logo link at the top with your own hosted image or use one from your `assets/` folder. Example:
91+
92+
<img src="assets/logo.png" alt="KoreUI Logo" height="120" />
93+
94+
---
95+
96+
## 📝 License
97+
98+
MIT License — free for personal and commercial use.
99+
100+
---
101+
102+
## 🙌 Credits
103+
104+
Built with ❤️ using PySide6, JSON Schema, and caffeine.

app.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import sys
2+
from PySide6.QtWidgets import QApplication, QScrollArea, QVBoxLayout, QWidget
3+
4+
from src.koreui import JsonSchemaForm
5+
from src.loader import load_schema
6+
7+
8+
def main():
9+
try:
10+
# Load the schema
11+
schema = load_schema('example_schema.json')
12+
13+
# Create the application
14+
app = QApplication(sys.argv)
15+
16+
# Create main window widget
17+
main_widget = QWidget()
18+
main_widget.setWindowTitle("JSON Schema Form")
19+
main_widget.resize(800, 600)
20+
21+
# Create layout
22+
layout = QVBoxLayout(main_widget)
23+
24+
# Create the form
25+
form = JsonSchemaForm(schema)
26+
27+
# Create scroll area and add form to it
28+
scroll_area = QScrollArea()
29+
scroll_area.setWidget(form)
30+
scroll_area.setWidgetResizable(True)
31+
32+
# Add scroll area to layout
33+
layout.addWidget(scroll_area)
34+
35+
# Show the main widget
36+
main_widget.show()
37+
38+
# Run the application
39+
sys.exit(app.exec())
40+
41+
except FileNotFoundError:
42+
print("Error: example_schema.json file not found")
43+
sys.exit(1)
44+
except Exception as e:
45+
print(f"Error: {e}")
46+
sys.exit(1)
47+
48+
49+
if __name__ == "__main__":
50+
main()

assets/logo.png

36.3 KB
Loading

example_schema.json

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Employee Record",
4+
"type": "object",
5+
"properties": {
6+
"name": {
7+
"type": "string"
8+
},
9+
"employeeType": {
10+
"type": "string",
11+
"enum": ["full-time", "part-time", "contractor"]
12+
},
13+
"salary": {
14+
"type": "number",
15+
"minimum": 0
16+
},
17+
"hourlyRate": {
18+
"type": "number",
19+
"minimum": 0
20+
},
21+
"benefits": {
22+
"type": "object",
23+
"properties": {
24+
"healthInsurance": {
25+
"type": "boolean"
26+
},
27+
"retirement401k": {
28+
"type": "boolean"
29+
}
30+
}
31+
},
32+
"contractEndDate": {
33+
"type": "string",
34+
"format": "date"
35+
},
36+
"department": {
37+
"type": "string"
38+
}
39+
},
40+
"required": ["name", "employeeType"],
41+
"if": {
42+
"properties": {
43+
"employeeType": {
44+
"const": "full-time"
45+
}
46+
}
47+
},
48+
"then": {
49+
"required": ["salary", "benefits"],
50+
"properties": {
51+
"salary": {
52+
"minimum": 30000
53+
}
54+
},
55+
"not": {
56+
"required": ["hourlyRate", "contractEndDate"]
57+
}
58+
},
59+
"else": {
60+
"if": {
61+
"properties": {
62+
"employeeType": {
63+
"const": "part-time"
64+
}
65+
}
66+
},
67+
"then": {
68+
"required": ["hourlyRate"],
69+
"not": {
70+
"required": ["salary", "contractEndDate"]
71+
}
72+
},
73+
"else": {
74+
"if": {
75+
"properties": {
76+
"employeeType": {
77+
"const": "contractor"
78+
}
79+
}
80+
},
81+
"then": {
82+
"required": ["hourlyRate", "contractEndDate"],
83+
"not": {
84+
"required": ["salary", "benefits"]
85+
}
86+
}
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)