-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
52 lines (38 loc) · 1.33 KB
/
app.py
File metadata and controls
52 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
import json
from PySide6.QtWidgets import QApplication, QScrollArea, QVBoxLayout, QWidget
from src.kore import JsonSchemaForm
from src.loader import load_schema
def main():
try:
# Load the schema
schema = load_schema('example_schema.json')
print("Loaded schema:", json.dumps(schema, indent=2))
# Create the application
app = QApplication(sys.argv)
# Create main window widget
main_widget = QWidget()
main_widget.setWindowTitle("JSON Schema Form")
main_widget.resize(800, 600)
# Create layout
layout = QVBoxLayout(main_widget)
# Create the form
form = JsonSchemaForm(schema)
# Create scroll area and add form to it
scroll_area = QScrollArea()
scroll_area.setWidget(form)
scroll_area.setWidgetResizable(True)
# Add scroll area to layout
layout.addWidget(scroll_area)
# Show the main widget
main_widget.show()
# Run the application
sys.exit(app.exec())
except FileNotFoundError:
print("Error: example_schema.json file not found")
sys.exit(1)
except Exception as e:
print(f"Error: {e}")
sys.exit(1)
if __name__ == "__main__":
main()