Files
Automotive-Power-Simulator-App/ui_mainwindow.py

263 lines
11 KiB
Python
Raw Normal View History

2026-01-07 11:47:54 +00:00
# -*- coding: utf-8 -*-
from PySide6.QtCore import (QCoreApplication, QMetaObject, QRect, Qt)
from PySide6.QtGui import (QBrush, QColor, QFont, QIcon, QPalette, QPixmap, QFontDatabase)
2026-01-19 20:38:59 +00:00
from PySide6.QtWidgets import (QRadioButton, QFrame, QLabel, QFileDialog, QPushButton, QWidget)
2026-01-07 11:47:54 +00:00
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)
2026-01-20 08:24:36 +00:00
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'))
2026-01-07 11:47:54 +00:00
fontmain = QFont()
fontmain.setFamilies([u"Optimism Sans"])
fontmain.setPointSize(8)
fontmain.setBold(True)
MainWindow.setFont(fontmain)
# Ensure the path is correct for your system!
2026-01-20 08:24:36 +00:00
image_path = "/home/david-rice/Python/Automotive-Power-Simulator-App/appbackground.jpg"
#image_path = "/home/dfr84/Python/Automotive-Power-Simulator-App/appbackground.jpg"
2026-01-07 11:47:54 +00:00
# --- 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")
2026-01-07 16:01:52 +00:00
self.header.setGeometry(QRect(50, 35, 750, 50))
2026-01-07 11:47:54 +00:00
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")
2026-01-07 16:01:52 +00:00
self.test_area.setGeometry(QRect(50, 115, 900, 440))
2026-01-07 11:47:54 +00:00
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")
2026-01-19 16:00:19 +00:00
self.connButton.setGeometry(QRect(25, 25, 200, 25))
2026-01-07 11:47:54 +00:00
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;
}
"""
2026-01-19 16:00:19 +00:00
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")
2026-01-19 20:38:59 +00:00
self.snLabel.setGeometry(QRect(350, 5, 200, 15))
2026-01-19 16:00:19 +00:00
self.snLabel.setAlignment(Qt.AlignCenter)
self.snLabel.setStyleSheet(text_label_style)
self.sn = QLabel(self.test_area)
self.sn.setObjectName(u"sn")
2026-01-19 20:38:59 +00:00
self.sn.setGeometry(QRect(350, 25, 200, 25))
2026-01-19 16:00:19 +00:00
self.sn.setAlignment(Qt.AlignCenter)
self.sn.setStyleSheet(label_style)
self.powerButton = QPushButton(self.test_area)
self.powerButton.setObjectName(u"powerButton")
2026-01-19 20:38:59 +00:00
self.powerButton.setGeometry(QRect(25, 150, 200, 25))
2026-01-19 16:00:19 +00:00
self.powerButton.setStyleSheet(button_style)
self.setvLabel = QLabel(self.test_area)
self.setvLabel.setObjectName(u"setvlabel")
2026-01-19 20:38:59 +00:00
self.setvLabel.setGeometry(QRect(350, 130, 200, 15))
2026-01-19 16:00:19 +00:00
self.setvLabel.setAlignment(Qt.AlignCenter)
self.setvLabel.setStyleSheet(text_label_style)
self.setv = QLabel(self.test_area)
self.setv.setObjectName(u"setv")
2026-01-19 20:38:59 +00:00
self.setv.setGeometry(QRect(350, 150, 200, 25))
2026-01-19 16:00:19 +00:00
self.setv.setAlignment(Qt.AlignCenter)
self.setv.setStyleSheet(label_style)
self.actvLabel = QLabel(self.test_area)
self.actvLabel.setObjectName(u"actvlabel")
2026-01-19 20:38:59 +00:00
self.actvLabel.setGeometry(QRect(675, 130, 200, 15))
2026-01-19 16:00:19 +00:00
self.actvLabel.setAlignment(Qt.AlignCenter)
self.actvLabel.setStyleSheet(text_label_style)
self.actv = QLabel(self.test_area)
self.actv.setObjectName(u"actv")
2026-01-19 20:38:59 +00:00
self.actv.setGeometry(QRect(675, 150, 200, 25))
2026-01-19 16:00:19 +00:00
self.actv.setAlignment(Qt.AlignCenter)
self.actv.setStyleSheet(label_style)
2026-01-19 20:38:59 +00:00
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 {
2026-01-20 08:24:36 +00:00
font-size: 12px;
2026-01-19 20:38:59 +00:00
background-color: #FF80D4;
border: 1px solid #FF33BB;
border-radius: 1px;
spacing: 10px;
2026-01-20 08:24:36 +00:00
padding-left: 40px;
2026-01-19 20:38:59 +00:00
}
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")
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)
2026-01-20 08:24:36 +00:00
self.scriptLabel = QLabel(self.test_area)
self.scriptLabel.setObjectName(u"scriptlabel")
self.scriptLabel.setGeometry(QRect(25, 130, 400, 15))
self.scriptLabel.setAlignment(Qt.AlignCenter)
self.scriptLabel.setStyleSheet(text_label_style)
self.script = QLabel(self.test_area)
self.script.setObjectName(u"script")
self.script.setGeometry(QRect(25, 150, 400, 25))
self.script.setAlignment(Qt.AlignCenter)
self.script.setStyleSheet(label_style)
self.openButton = QPushButton(self.test_area)
self.openButton.setObjectName(u"openButton")
self.openButton.setGeometry(QRect(450, 150, 200, 25))
self.openButton.setStyleSheet(button_style)
self.runButton = QPushButton(self.test_area)
self.runButton.setObjectName(u"runButton")
self.runButton.setGeometry(QRect(675, 150, 200, 25))
self.runButton.setStyleSheet(button_style)
2026-01-19 20:38:59 +00:00
2026-01-07 11:47:54 +00:00
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))
2026-01-19 16:00:19 +00:00
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))
2026-01-20 08:24:36 +00:00
self.scriptLabel.setText(QCoreApplication.translate("MainWindow", u"SCRIPT FILE", None))
self.script.setText(QCoreApplication.translate("MainWindow", u"---", None))
self.openButton.setText(QCoreApplication.translate("MainWindow", u"SCRIPT FILE", None))
self.runButton.setText(QCoreApplication.translate("MainWindow", u"RUN SCRIPT", None))
2026-01-07 11:47:54 +00:00
# retranslateUi