From e68ff9a4d848f2d28317ec7b0db192bcd936a414 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Fri, 1 Apr 2011 12:18:55 +0300 Subject: [PATCH] QML: main for the QML version --- src/mussorgsky-qml.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/mussorgsky-qml.py diff --git a/src/mussorgsky-qml.py b/src/mussorgsky-qml.py new file mode 100644 index 0000000..a78f09e --- /dev/null +++ b/src/mussorgsky-qml.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import sys +from PySide.QtCore import * +from PySide.QtGui import * +from PySide.QtDeclarative import QDeclarativeView + +from qml.albumModel import AlbumModel +from qml.logic import MussorgskyLogic + +# Create Qt application and the QDeclarative view +app = QApplication(sys.argv) +view = QDeclarativeView() + + +#MOCK_DATA = [ +# AlbumItem ("Are you experienced?", "Jimy Hendrix", None), +# AlbumItem ("Bring them all back home", "Bob dylan", None), +# AlbumItem ("OK computer", "Radiohead", None), +# AlbumItem ("Absolution", "Muse", None), +# AlbumItem ("Come with us", "Chemical brothers", None) +# ] + +logic = MussorgskyLogic () + +albumModel = AlbumModel (logic.get_all_albums()) +print "Model with", albumModel.rowCount(), "rows" + +rc = view.rootContext () +rc.setContextProperty ('albumModel', albumModel) + +# Create an URL to the QML file +#url = QUrl('view.qml') +url = QUrl ("../ui/main.qml") +# Set the QML file and show +view.setSource(url) + + +view.show() +# Enter Qt main loop +sys.exit(app.exec_()) -- 1.7.9.5