# -*- coding: utf-8 -*- from PySide6.QtCore import (QCoreApplication, QMetaObject, QRect, Qt) from PySide6.QtGui import (QBrush, QColor, QFont, QIcon, QPalette, QPixmap, QFontDatabase) from PySide6.QtWidgets import (QRadioButton, QFrame, QLabel, QFileDialog, QPushButton, QWidget) class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.setToolButtonStyle(Qt.ToolButtonIconOnly) MainWindow.setAnimated(True) MainWindow.setDocumentMode(False) #MainWindow.setWindowIcon(QIcon('/home/david-rice/Python/Automotive-Power-Simulator-App/arriveico.png')) MainWindow.setWindowIcon(QIcon('/home/dfr84/Python/Automotive-Power-Simulator-App/arriveico.png')) fontmain = QFont() fontmain.setFamilies([u"Optimism Sans"]) fontmain.setPointSize(8) fontmain.setBold(True) MainWindow.setFont(fontmain) # Ensure the path is correct for your system! #image_path = "/home/david-rice/Python/Automotive-Power-Simulator-App/appbackground.jpg" image_path = "/home/dfr84/Python/Automotive-Power-Simulator-App/appbackground.jpg" # --- Define and Apply the Style Sheet --- bg_style_sheet = f""" QWidget {{ background-image: url("{image_path}"); background-repeat: no-repeat; background-position: center; }} """ self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.centralwidget.setStyleSheet(bg_style_sheet) self.header = QLabel(self.centralwidget) self.header.setObjectName(u"header") self.header.setGeometry(QRect(50, 35, 750, 50)) font = QFont() font.setFamilies([u"Optimism Sans"]) font.setPointSize(24) font.setBold(True) self.header.setFont(font) self.header.setStyleSheet("color: #5F016F;") self.header.setAlignment(Qt.AlignCenter) self.test_area = QFrame(self.centralwidget) self.test_area.setObjectName(u"test_area") self.test_area.setGeometry(QRect(50, 115, 900, 440)) self.test_area.setFrameShape(QFrame.StyledPanel) self.test_area.setFrameShadow(QFrame.Raised) button_style = """ QPushButton { background-color: #FF80D4; border: 1px solid #FF33BB; border-radius: 1px; } """ self.connButton = QPushButton(self.test_area) self.connButton.setObjectName(u"connButton") self.connButton.setGeometry(QRect(25, 25, 200, 25)) self.connButton.setStyleSheet(button_style) text_label_style = """ QLabel { background-image: url(""); background-color: #FF80D4; border: 0px solid #FF33BB; border-radius: 0px; } """ label_style = """ QLabel { background-image: url(""); background-color: #FF80D4; border: 1px solid #FF33BB; border-radius: 1px; } """ self.fwLabel = QLabel(self.test_area) self.fwLabel.setObjectName(u"fwLabel") self.fwLabel.setGeometry(QRect(675, 5, 200, 15)) self.fwLabel.setAlignment(Qt.AlignCenter) self.fwLabel.setStyleSheet(text_label_style) self.fw = QLabel(self.test_area) self.fw.setObjectName(u"fw") self.fw.setGeometry(QRect(675, 25, 200, 25)) self.fw.setAlignment(Qt.AlignCenter) self.fw.setStyleSheet(label_style) self.snLabel = QLabel(self.test_area) self.snLabel.setObjectName(u"snlabel") self.snLabel.setGeometry(QRect(350, 5, 200, 15)) self.snLabel.setAlignment(Qt.AlignCenter) self.snLabel.setStyleSheet(text_label_style) self.sn = QLabel(self.test_area) self.sn.setObjectName(u"sn") self.sn.setGeometry(QRect(350, 25, 200, 25)) self.sn.setAlignment(Qt.AlignCenter) self.sn.setStyleSheet(label_style) self.powerButton = QPushButton(self.test_area) self.powerButton.setObjectName(u"powerButton") self.powerButton.setGeometry(QRect(25, 150, 200, 25)) self.powerButton.setStyleSheet(button_style) self.setvLabel = QLabel(self.test_area) self.setvLabel.setObjectName(u"setvlabel") self.setvLabel.setGeometry(QRect(350, 130, 200, 15)) self.setvLabel.setAlignment(Qt.AlignCenter) self.setvLabel.setStyleSheet(text_label_style) self.setv = QLabel(self.test_area) self.setv.setObjectName(u"setv") self.setv.setGeometry(QRect(350, 150, 200, 25)) self.setv.setAlignment(Qt.AlignCenter) self.setv.setStyleSheet(label_style) self.actvLabel = QLabel(self.test_area) self.actvLabel.setObjectName(u"actvlabel") self.actvLabel.setGeometry(QRect(675, 130, 200, 15)) self.actvLabel.setAlignment(Qt.AlignCenter) self.actvLabel.setStyleSheet(text_label_style) self.actv = QLabel(self.test_area) self.actv.setObjectName(u"actv") self.actv.setGeometry(QRect(675, 150, 200, 25)) self.actv.setAlignment(Qt.AlignCenter) self.actv.setStyleSheet(label_style) self.radiolocal = QRadioButton("LOCAL CONTROL", self.test_area) self.radiolocal.setObjectName(u"radiolocal") self.radiolocal.setGeometry(QRect(25, 75, 200, 25)) self.radioscript = QRadioButton("SCRIPT CONTROL", self.test_area) self.radioscript.setObjectName(u"radioscript") self.radioscript.setGeometry(QRect(350, 75, 200, 25)) self.radiopulse = QRadioButton("PULSE TRIGGERED", self.test_area) self.radiopulse.setObjectName(u"radiopulse") self.radiopulse.setGeometry(QRect(675, 75, 200, 25)) radiostyle = (""" QRadioButton { font-size: 14px; background-color: #FF80D4; border: 1px solid #FF33BB; border-radius: 1px; spacing: 10px; padding-left: 30px; } QRadioButton::indicator { subcontrol-origin: content; subcontrol-position: center left; width: 15px; height: 15px; } """) self.radiolocal.setStyleSheet(radiostyle) self.radioscript.setStyleSheet(radiostyle) self.radiopulse.setStyleSheet(radiostyle) self.fileexplorer = QFileDialog (self.test_area) self.fileexplorer.setOption(QFileDialog.Option.DontUseNativeDialog, True) self.fileexplorer.setObjectName(u"fileexplorer") self.fileexplorer.setGeometry(QRect(25, 150, 200, 25)) filedialogstyle = (""" QFileDialog { background-color: #FF80D4; border: 4px solid #FF33BB; } /* Style the file list/tree area */ QTreeView, QListView { background-color: white; border: 1px solid #FF33BB; selection-background-color: #FF33BB; } /* Style the bottom buttons */ QPushButton { background-color: #FF33BB; color: white; border-radius: 4px; min-width: 80px; padding: 5px; } """) self.fileexplorer.setStyleSheet(filedialogstyle) frame_style = """ QFrame { background-image: url(""); background-color: #FF80D4; border: 1px solid #FF33BB; border-radius: 10px; } """ self.test_area.setStyleSheet(frame_style) MainWindow.setCentralWidget(self.centralwidget) self.header.raise_() self.test_area.raise_() self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"AUTOMOTIVE POWER SIMULATOR V1.0", None)) self.header.setText(QCoreApplication.translate("MainWindow", u"AUTOMOTIVE POWER SIMULATOR", None)) self.connButton.setText(QCoreApplication.translate("MainWindow", u"CONNECT", None)) self.snLabel.setText(QCoreApplication.translate("MainWindow", u"SERIAL NO", None)) self.sn.setText(QCoreApplication.translate("MainWindow", u"---", None)) self.fwLabel.setText(QCoreApplication.translate("MainWindow", u"F/W REV", None)) self.fw.setText(QCoreApplication.translate("MainWindow", u"---", None)) self.powerButton.setText(QCoreApplication.translate("MainWindow", u"POWER OFF", None)) self.setvLabel.setText(QCoreApplication.translate("MainWindow", u"VOLTAGE SETPOINT", None)) self.setv.setText(QCoreApplication.translate("MainWindow", u"00.00V", None)) self.actvLabel.setText(QCoreApplication.translate("MainWindow", u"VOLTAGE MEASURED", None)) self.actv.setText(QCoreApplication.translate("MainWindow", u"00.00V", None)) # retranslateUi