diff options
author | 2024-06-02 21:44:04 +0530 | |
---|---|---|
committer | 2024-06-24 00:06:49 +0530 | |
commit | b742c6d5b26c036addb2922e36d06dbea35c10f1 (patch) | |
tree | 36b6c2349e5b6ce93de40884c9d62bae442bb410 /Widgets/ICPage.py | |
parent | 31573c88e0ddefc3591bb7752b306601554ebbf2 (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 'Widgets/ICPage.py')
-rw-r--r-- | Widgets/ICPage.py | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/Widgets/ICPage.py b/Widgets/ICPage.py index 4a32211..f2e41a7 100644 --- a/Widgets/ICPage.py +++ b/Widgets/ICPage.py @@ -6,14 +6,11 @@ import os import logging import sys -from PyQt5 import uic, QtCore, QtWidgets -from PyQt5.QtWidgets import QApplication -from PyQt5.QtGui import QIcon, QPixmap, QPainter -from PyQt5.QtCore import QObject, pyqtSignal -from PyQt5.QtWidgets import QWidget -from qtwidgets import AnimatedToggle -from extras.KuksaClient import KuksaClient -from extras.VehicleSimulator import VehicleSimulator +from PyQt6 import uic, QtCore, QtWidgets +from PyQt6.QtWidgets import QApplication +from PyQt6.QtGui import QIcon, QPixmap, QPainter +from PyQt6.QtCore import QObject, pyqtSignal +from PyQt6.QtWidgets import QWidget current_dir = os.path.dirname(os.path.abspath(__file__)) @@ -26,6 +23,10 @@ Form, Base = uic.loadUiType(os.path.join(current_dir, "../ui/IC.ui")) # ======================================== +from extras.KuksaClient import KuksaClient +from extras.VehicleSimulator import VehicleSimulator +import res_rc +from Widgets.animatedToggle import AnimatedToggle class IC_Paths(): def __init__(self): @@ -66,10 +67,7 @@ class ICWidget(Base, Form): self.IC_Frame = self.findChild(QWidget, "frame_1") - self.Script_toggle = AnimatedToggle( - checked_color="#4BD7D6", - pulse_checked_color="#00ffff" - ) + self.Script_toggle = AnimatedToggle() layout.replaceWidget(self.demoToggle, self.Script_toggle) self.demoToggle.deleteLater() @@ -175,13 +173,13 @@ class ICWidget(Base, Form): """ hazardIcon = QPixmap(":/Images/Images/hazard.png") painter = QPainter(hazardIcon) - painter.setCompositionMode(QPainter.CompositionMode_SourceIn) + painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn) if self.hazardBtn.isChecked(): - color = QtCore.Qt.yellow + color = QtCore.Qt.GlobalColor.yellow value = "true" else: - color = QtCore.Qt.black + color = QtCore.Qt.GlobalColor.black value = "false" painter.fillRect(hazardIcon.rect(), color) @@ -204,13 +202,13 @@ class ICWidget(Base, Form): """ leftIndicatorIcon = QPixmap(":/Images/Images/left.png") painter = QPainter(leftIndicatorIcon) - painter.setCompositionMode(QPainter.CompositionMode_SourceIn) + painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn) if self.leftIndicatorBtn.isChecked(): - color = QtCore.Qt.green + color = QtCore.Qt.GlobalColor.green value = "true" else: - color = QtCore.Qt.black + color = QtCore.Qt.GlobalColor.black value = "false" painter.fillRect(leftIndicatorIcon.rect(), color) @@ -228,13 +226,13 @@ class ICWidget(Base, Form): """ rightIndicatorIcon = QPixmap(":/Images/Images/right.png") painter = QPainter(rightIndicatorIcon) - painter.setCompositionMode(QPainter.CompositionMode_SourceIn) + painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn) if self.rightIndicatorBtn.isChecked(): - color = QtCore.Qt.green + color = QtCore.Qt.GlobalColor.green value = "true" else: - color = QtCore.Qt.black + color = QtCore.Qt.GlobalColor.black value = "false" painter.fillRect(rightIndicatorIcon.rect(), color) @@ -371,4 +369,4 @@ if __name__ == '__main__': app = QApplication(sys.argv) w = ICWidget() w.show() - sys.exit(app.exec_()) + sys.exit(app.exec()) |