-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
42 lines (24 loc) · 971 Bytes
/
app.py
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
import sys
# pip install PySide6
from PySide6 import QtQml
from PySide6 import QtWidgets
from PySide6.QtQuickControls2 import QQuickStyle
from models import core
def main():
QQuickStyle.setStyle('Fusion')
app = QtWidgets.QApplication([])
QtQml.qmlRegisterType(core.NewSite, 'MonObjects', 1, 0, 'NewSite')
#QtQml.qmlRegisterType(core.NewSite, 'MonObjects', 1, 0, 'NewSite2')
engine = QtQml.QQmlApplicationEngine()
engine.quit.connect(app.quit)
engine.load('qml/containers/Main.qml')
# could load sites here and use as input to model
sites_model = core.SitesModel()
sites_model.load() # load existing data
engine.rootContext().setContextProperty('sitesModel', sites_model)
#new_site_filter = core.SiteFilter()
#new_site_filter.setSourceModel(sites_model)
#engine.rootContext().setContextProperty('newSiteFilterModel', new_site_filter)
sys.exit(app.exec())
if __name__ == '__main__':
main()