Add python code
This commit is contained in:
parent
3707c44450
commit
404d8e0f18
1 changed files with 34 additions and 0 deletions
34
src/main.py
Normal file
34
src/main.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
from PySide6.QtGui import QGuiApplication
|
||||
from PySide6.QtCore import QUrl
|
||||
from PySide6.QtQml import QQmlApplicationEngine
|
||||
|
||||
|
||||
def main():
|
||||
"""Initializes and manages the application execution"""
|
||||
app: QGuiApplication = QGuiApplication(sys.argv)
|
||||
engine = QQmlApplicationEngine()
|
||||
|
||||
"""Needed to close the app with Ctrl+C"""
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
|
||||
"""Needed to get proper KDE style outside of Plasma"""
|
||||
if not os.environ.get("QT_QUICK_CONTROLS_STYLE"):
|
||||
os.environ["QT_QUICK_CONTROLS_STYLE"] = "org.kde.desktop"
|
||||
|
||||
base_path = os.path.abspath(os.path.dirname(__file__))
|
||||
url = QUrl(f"file://{base_path}/main.qml")
|
||||
engine.load(url)
|
||||
|
||||
if len(engine.rootObjects()) == 0:
|
||||
quit()
|
||||
|
||||
app.exec()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue