Move the qml/* files to the src folder. Now it is the main version
[mussorgsky] / src / mussorgsky-qml.py
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3  
4 import sys
5 from PySide.QtCore import *
6 from PySide.QtGui import *
7 from PySide.QtDeclarative import QDeclarativeView
8
9 from albumModel import AlbumModel
10 from controller import MussorgskyController
11
12 # Create Qt application and the QDeclarative view
13 app = QApplication(sys.argv)
14 view = QDeclarativeView()
15
16 controller = MussorgskyController (view.rootContext ())
17
18 #from albumItem import AlbumItem
19 #MOCK_DATA = [AlbumItem (u"x", u"y") for i in xrange (0, 100)]
20 #albumModel = AlbumModel (MOCK_DATA)
21
22 albumModel = AlbumModel (controller.get_all_albums())
23 print "Model with", albumModel.rowCount(), "rows"
24
25 #from coverModel import CoversModel
26 #coverModel = CoversModel ()
27
28 rc = view.rootContext ()
29 rc.setContextProperty ('albumModel', albumModel)
30 rc.setContextProperty ('missionControl', controller)
31 #rc.setContextProperty ('coversModel', coverModel)
32
33 # Create an URL to the QML file
34 #url = QUrl('view.qml')
35 url = QUrl ("../../ui/main.qml")
36 # Set the QML file and show
37 view.setSource(url)
38 view.engine().quit.connect (app.quit)
39
40 view.show()
41
42
43 # Enter Qt main loop
44 sys.exit(app.exec_())