-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (30 loc) · 1.17 KB
/
main.py
File metadata and controls
43 lines (30 loc) · 1.17 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
# -*- coding: utf-8 -*-
"""."""
import sys
from PySide6 import QtCore, QtGui, QtQml
APPLICATION_NAME = 'br.com.justcode.Qt'
ORGANIZATION_NAME = APPLICATION_NAME.split('.')[2]
ORGANIZATION_DOMAIN = '.'.join(APPLICATION_NAME.split('.')[0:3])
BASE_DIR = QtCore.QDir(QtCore.QFileInfo(__file__).absolutePath())
QML_DIR = BASE_DIR.filePath('qml')
QML_FILE = QtCore.QDir(QML_DIR).filePath('main.qml')
def main() -> None:
application = QtGui.QGuiApplication(sys.argv)
application.setApplicationDisplayName(APPLICATION_NAME)
application.setApplicationName(APPLICATION_NAME)
application.setDesktopFileName(APPLICATION_NAME)
application.setOrganizationName(ORGANIZATION_NAME)
application.setOrganizationDomain(ORGANIZATION_DOMAIN)
if QtCore.QSysInfo.productType() == 'windows':
from ctypes import windll
windll.shell32.SetCurrentProcessExplicitAppUserModelID(
APPLICATION_NAME,
)
engine = QtQml.QQmlApplicationEngine()
engine.addImportPath(QML_DIR)
engine.load(QtCore.QUrl.fromLocalFile(QML_FILE))
if not engine.rootObjects():
sys.exit(-1)
sys.exit(application.exec())
if __name__ == '__main__':
main()