aboutsummaryrefslogtreecommitdiffstats
path: root/Widgets/settings.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 /Widgets/settings.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 'Widgets/settings.py')
-rw-r--r--Widgets/settings.py35
1 files changed, 15 insertions, 20 deletions
diff --git a/Widgets/settings.py b/Widgets/settings.py
index 08f6a00..4adf72d 100644
--- a/Widgets/settings.py
+++ b/Widgets/settings.py
@@ -3,18 +3,16 @@
#
# SPDX-License-Identifier: Apache-2.0
-from extras import config
-import extras.Kuksa_Instance as kuksa_instance
+
import os
import sys
import time
-from PyQt5 import uic
-from PyQt5.QtWidgets import QApplication, QLineEdit, QPushButton, QLabel, QComboBox, QStyledItemDelegate
-from qtwidgets import AnimatedToggle
-from PyQt5.QtWidgets import QWidget
-from PyQt5.QtCore import QThread
-from PyQt5 import QtGui
+from PyQt6.QtWidgets import QApplication, QLineEdit, QPushButton, QLabel
+from PyQt6 import uic
+from PyQt6.QtWidgets import QWidget
+from PyQt6.QtCore import QThread
+from PyQt6 import QtGui
import logging
import can
@@ -24,6 +22,11 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(current_dir))
+from extras import config
+import extras.Kuksa_Instance as kuksa_instance
+from Widgets.animatedToggle import AnimatedToggle
+import res_rc
+
Form, Base = uic.loadUiType(os.path.join(
current_dir, "../ui/Settings_Window.ui"))
@@ -34,14 +37,6 @@ Form, Base = uic.loadUiType(os.path.join(
Steering_Signal_Type = "Kuksa"
Protocol = None
-def create_animated_toggle():
- return AnimatedToggle(
- checked_color="#4BD7D6",
- pulse_checked_color="#00ffff",
- pulse_unchecked_color= "#4BD7D6",
- )
-
-
class settings(Base, Form):
"""
A class representing the settings widget of the AGL Demo Control Panel.
@@ -64,8 +59,8 @@ class settings(Base, Form):
self.setupUi(self)
self.client = None
- self.SSL_toggle = create_animated_toggle()
- self.Protocol_toggle = create_animated_toggle()
+ self.SSL_toggle = AnimatedToggle()
+ self.Protocol_toggle = AnimatedToggle()
self.connectionStatus = self.findChild(QLabel, "connectionStatus")
self.connectionLogo = self.findChild(QLabel, "connectionLogo")
@@ -96,7 +91,7 @@ class settings(Base, Form):
GS_layout.replaceWidget(self.place_holder_toggle_1, self.SSL_toggle)
GS_layout.replaceWidget(
- self.place_holder_toggle_2, self.Protocol_toggle)
+ self.place_holder_toggle_2, self.Protocol_toggle)
self.place_holder_toggle_1.deleteLater()
self.place_holder_toggle_2.deleteLater()
@@ -294,4 +289,4 @@ if __name__ == '__main__':
app = QApplication(sys.argv)
w = settings()
w.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())