-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
executable file
·78 lines (61 loc) · 2.49 KB
/
main.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
@package main
Run PyQt app
"""
import sys
import os
from PyQt5.QtQml import QQmlEngine
from PyQt5.QtCore import QUrl, QDir
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtGui import QIcon
from controllers.mainController import MainController
from controllers.noiseGeneratorController import NoiseGeneratorController
from controllers.colorCorrectorController import ColorCorrectorController
from controllers.filtersController import FiltersController
from controllers.binarizeController import BinarizeController
from controllers.morphologyController import MorphologyController
from controllers.segmentationController import SegmentationController
if __name__ == '__main__':
# Create main app
myApp = QApplication(sys.argv)
myApp.setWindowIcon(QIcon('./images/icon.png'))
# Create a View and set its properties
appView = QQuickView()
appView.setMinimumHeight(640)
appView.setMinimumWidth(1024)
appView.setTitle('roadLaneFinding')
engine = appView.engine()
engine.quit.connect(myApp.quit)
context = engine.rootContext()
# add paths
# appDir = os.getcwd()
# print(QDir.currentPath())
appDir = 'file:///' + QDir.currentPath()
# print(appDir)
# # print('appDir:', appDir)
# appDir = 'file:///h:/QtDocuments/AOI'
# print(appDir)
context.setContextProperty('appDir', appDir)
# add controllers
mainController = MainController()
context.setContextProperty('PyConsole', mainController)
context.setContextProperty('mainController', mainController)
colorCorrectorController = ColorCorrectorController()
context.setContextProperty('colorCorrectorController', colorCorrectorController)
noiseGeneratorController = NoiseGeneratorController()
context.setContextProperty('noiseGeneratorController', noiseGeneratorController)
filtersController = FiltersController()
context.setContextProperty('filtersController', filtersController)
binarizeController = BinarizeController()
context.setContextProperty('binarizeController', binarizeController)
morphologyController = MorphologyController()
context.setContextProperty('morphologyController', morphologyController)
segmentationController = SegmentationController()
context.setContextProperty('segmentationController', segmentationController)
# Show the View
appView.setSource(QUrl('./qml/main.qml'))
appView.show()
# Execute the Application and Exit
myApp.exec_()
sys.exit()