-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathOpenIMU.py
More file actions
70 lines (52 loc) · 2.33 KB
/
OpenIMU.py
File metadata and controls
70 lines (52 loc) · 2.33 KB
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
import sys
import platform
import faulthandler
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCore import Qt
from PySide6.QtGui import QSurfaceFormat
from PySide6.QtQuick import QQuickWindow, QSGRendererInterface
def except_hook(cls, exception, traceback):
# Display error dialog
from libopenimu.qt.CrashWindow import CrashWindow
crash_dlg = CrashWindow(traceback, exception)
crash_dlg.exec()
sys.__excepthook__(cls, exception, traceback)
# Main
if __name__ == '__main__':
from PySide6.QtCore import QDir
from libopenimu.qt.OpenIMUApp import OpenIMUApp
from libopenimu.qt.MainWindow import MainWindow
if not (getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS')):
faulthandler.enable() # start @ the beginning
try:
# Close the splash screen, if running from a frozen package with pyinstaller
import pyi_splash
pyi_splash.close()
except ModuleNotFoundError:
pass
# Needed for the webengine to work properly
# Initially useful for MacOS, but also seem to improve speed a little in Windows...
# if platform.system() == 'Darwin':
QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
QQuickWindow.setGraphicsApi(QSGRendererInterface.OpenGLRhi)
app = OpenIMUApp()
# Route errors to error dialog
# sys.excepthook = except_hook
# Set current directory to home path
QDir.setCurrent(QDir.homePath())
# print(PyQt5.__file__)
# from pprint import pprint
# from PyQt5.QtCore import QLibraryInfo
# paths = [x for x in dir(QLibraryInfo) if x.endswith('Path')]
# pprint({x: QLibraryInfo.location(getattr(QLibraryInfo, x)) for x in paths})
# WebEngine settings
# QWebEngineSettings.globalSettings().setAttribute(QWebEngineSettings.PluginsEnabled, True)
# QWebEngineSettings.globalSettings().setAttribute(QWebEngineSettings.JavascriptCanOpenWindows, True)
# QWebEngineSettings.globalSettings().setAttribute(QWebEngineSettings.JavascriptEnabled, True)
# QWebEngineSettings.globalSettings().setAttribute(QWebEngineSettings.LocalContentCanAccessRemoteUrls,True)
# QWebEngineSettings.globalSettings().setAttribute(QWebEngineSettings.AllowRunningInsecureContent, True)
# Create Main Window
# window = MainWindow()
# Exec application
exit_code = app.exec()
sys.exit(exit_code)