-
Notifications
You must be signed in to change notification settings - Fork 0
/
show.py
27 lines (24 loc) · 797 Bytes
/
show.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
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtQml import QQmlApplicationEngine
from DoubanFM import DoubanFM
import Logger
# Main Function
if __name__ == '__main__':
# Create main app
main_app = QGuiApplication(sys.argv)
# Create a label and set its properties
douban = DoubanFM()
logger = Logger.Logger()
engine = QQmlApplicationEngine(parent=main_app)
root_context = engine.rootContext()
root_context.setContextProperty("douban", douban)
root_context.setContextProperty("logger", logger)
mainurl = "qml/main.qml"
engine.load(QUrl(mainurl))
# Execute the Application and Exit
rc = main_app.exec_()
sys.exit(rc)