-
Notifications
You must be signed in to change notification settings - Fork 0
/
learn_ml.py
51 lines (37 loc) · 1.73 KB
/
learn_ml.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
'''Main entry-point to launch the application.
This will launch the learn_ml application to a new project.
'''
import sys, os
import argparse
from PySide2.QtGui import QGuiApplication
from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType
from PySide2.QtCore import QUrl
from learn_ml.utils.log_configurator import LogConfigurator
from learn_ml.ui.python_classes.NavigationButton import NavigationButton
from learn_ml.ui.python_classes.SearchPanel import SearchPanel
from learn_ml.ui.python_classes.NodeManager import NodeManager
def main(verbosity, log_to_file):
# Configure the LogConfigurator and instantiate logger for this module
logConfig = LogConfigurator(verbosity = "DEBUG", output_to_logfile = log_to_file)
# Create the QML Application and Engine
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
# Instantiate custom python classes and add them to QML engine
nav_buttons = NavigationButton()
search_panels = SearchPanel()
qmlRegisterType(NavigationButton, "NavigationButton", 1, 0, "NavigationButton")
qmlRegisterType(SearchPanel, "Search", 1, 0, "SearchPanel")
qmlRegisterType(NodeManager, "Node", 1, 0, "NodeManager")
# Load the main QML file
engine.load(QUrl("learn_ml/ui/app.qml"))
if not engine.rootObjects():
sys.exit(-1)
# Begin execution
sys.exit(app.exec_())
if __name__ == '__main__':
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbosity', help='Verbosity level, options are DEBUG, INFO, WARN, ERROR, CRITICAL', default="INFO")
parser.add_argument('-p', '--print', help='Address of the coral device', action= "store_false")
args = parser.parse_args()
main(args.verbosity, False)