aboutsummaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorSuchinton <suchinton.2001@gmail.com>2024-06-02 21:44:04 +0530
committerSuchinton <suchinton.2001@gmail.com>2024-06-24 00:06:49 +0530
commitb742c6d5b26c036addb2922e36d06dbea35c10f1 (patch)
tree36b6c2349e5b6ce93de40884c9d62bae442bb410 /main.py
parent31573c88e0ddefc3591bb7752b306601554ebbf2 (diff)
Port AGL Demo Control Panel to Qt6
This commit includes the following changes: V1: - Migrated from PyQt5 to PyQt6/PySide6 with minor syntax adjustments. - Removed the dependency on qtwidgets and extracted only the required animated toggle module, patching it to work with PyQt6. - Updated the README to include new steps for compiling resources. - Bumped QtPy from version 2.3.1 to 2.4.1 V2: - Refactored set_icon function in Dashboard module to make use of QIcon directly instead of using the QtSvg library (Invalid in PyQt6) - Syntax changes in UI_Handeler to use PyQt6 V3: - Update gitignore - Remove dependency on qtpy V4: - Added new animated toggle button - Refactored ICPage and Settings to use new toggle - Updated Navigation Bar Animation to have Bounce effect using "OutBounce" QEasingCurve Bug-AGL: SPEC-5161 Change-Id: I44499bb5165d5794af7e9aae3407ffae1f7e1928 Signed-off-by: Suchinton <suchinton.2001@gmail.com>
Diffstat (limited to 'main.py')
-rw-r--r--main.py31
1 files changed, 12 insertions, 19 deletions
diff --git a/main.py b/main.py
index 18cc49b..1fded6e 100644
--- a/main.py
+++ b/main.py
@@ -14,25 +14,21 @@
limitations under the License.
"""
-from Widgets.Dashboard import Dashboard
-from extras.UI_Handeler import *
import sys
import os
-from PyQt5 import uic, QtCore, QtWidgets
-from PyQt5.QtWidgets import QApplication, QPushButton, QWidget
+from PyQt6 import uic, QtCore, QtWidgets
+from PyQt6.QtWidgets import QApplication, QPushButton, QWidget
from functools import partial
-from PyQt5 import QtGui
-from PyQt5.QtCore import Qt
-from PyQt5 import QtSvg
-from PyQt5.QtSvg import *
-from PyQt5.QtGui import QIcon
-
-import extras.config as config
+from PyQt6 import QtGui
+from PyQt6.QtCore import Qt
current_dir = os.path.dirname(os.path.abspath(__file__))
Form, Base = uic.loadUiType(os.path.join(current_dir, "Main_Window.ui"))
+from Widgets.Dashboard import Dashboard
+from extras.UI_Handeler import *
+import extras.config as config
class MainWindow(Base, Form):
"""
@@ -53,8 +49,8 @@ class MainWindow(Base, Form):
"""
super(self.__class__, self).__init__(parent)
self.setupUi(self)
- self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
- self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
+ self.setWindowFlag(QtCore.Qt.WindowType.FramelessWindowHint)
+ self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TranslucentBackground)
self.setStyle(QtWidgets.QStyleFactory.create('Fusion'))
# set fullscreen mode if enabled in config.ini
@@ -104,10 +100,7 @@ class MainWindow(Base, Form):
self.settingsBtn)
steering_icon = ":/Images/Images/steering-wheel.svg"
- svg_widget = QtSvg.QSvgWidget(steering_icon)
- svg_widget.setFixedSize(QtSvg.QSvgRenderer(steering_icon).defaultSize())
- svg_widget.setStyleSheet("background-color: transparent;")
- self.steeringCtrlButton.setIcon(QIcon(svg_widget.grab()))
+ self.steeringCtrlButton.setIcon(QtGui.QIcon(steering_icon))
if not config.hvac_enabled():
self.hvacButton.hide()
@@ -150,7 +143,7 @@ class MainWindow(Base, Form):
}
""")
self.centralwidget.layout().addWidget(
- self.size_grip, 0, Qt.AlignBottom | Qt.AlignRight)
+ self.size_grip, 0, Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignRight)
def VSS_callback(self, data):
pass
@@ -188,4 +181,4 @@ if __name__ == '__main__':
':/Images/Images/Automotive_Grade_Linux_logo.svg'))
window = MainWindow()
window.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())