Added basic GUI

This commit is contained in:
David Rice
2026-01-07 11:47:54 +00:00
parent 0b11e8541f
commit 8e92a4b47e
19 changed files with 633 additions and 0 deletions

170
ui_mainwindow.py Normal file
View File

@@ -0,0 +1,170 @@
# -*- 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 (QCheckBox, QFrame, QLabel, QProgressBar, QSlider, QPushButton, QWidget, QVBoxLayout)
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/davidrice/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/davidrice/Python/Automotive-Power-Simulator-App/appbackground.jpg" # Example Path
# --- 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, 650, 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, 924, 618))
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, 125, 25))
self.connButton.setStyleSheet(button_style)
text_label_style = """
QLabel {
background-image: url("");
background-color: #FF80D4;
border: 0px solid #FF33BB;
border-radius: 0px;
}
"""
self.manuLabel = QLabel(self.test_area)
self.manuLabel.setObjectName(u"manuLabel")
self.manuLabel.setGeometry(QRect(200, 5, 250, 15))
self.manuLabel.setAlignment(Qt.AlignCenter)
self.manuLabel.setStyleSheet(text_label_style)
label_style = """
QLabel {
background-image: url("");
background-color: #FF80D4;
border: 1px solid #FF33BB;
border-radius: 1px;
}
"""
self.manu = QLabel(self.test_area)
self.manu.setObjectName(u"manu")
self.manu.setGeometry(QRect(200, 25, 250, 25))
self.manu.setAlignment(Qt.AlignCenter)
self.manu.setStyleSheet(label_style)
self.modelLabel = QLabel(self.test_area)
self.modelLabel.setObjectName(u"modelLabel")
self.modelLabel.setGeometry(QRect(475, 5, 125, 15))
self.modelLabel.setAlignment(Qt.AlignCenter)
self.modelLabel.setStyleSheet(text_label_style)
self.model = QLabel(self.test_area)
self.model.setObjectName(u"model")
self.model.setGeometry(QRect(475, 25, 125, 25))
self.model.setAlignment(Qt.AlignCenter)
self.model.setStyleSheet(label_style)
self.snLabel = QLabel(self.test_area)
self.snLabel.setObjectName(u"snlabel")
self.snLabel.setGeometry(QRect(625, 5, 125, 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(625, 25, 125, 25))
self.sn.setAlignment(Qt.AlignCenter)
self.sn.setStyleSheet(label_style)
self.fwLabel = QLabel(self.test_area)
self.fwLabel.setObjectName(u"fwLabel")
self.fwLabel.setGeometry(QRect(775, 5, 125, 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(775, 25, 125, 25))
self.fw.setAlignment(Qt.AlignCenter)
self.fw.setStyleSheet(label_style)
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.manuLabel.setText(QCoreApplication.translate("MainWindow", u"MANUFACTURER", None))
self.manu.setText(QCoreApplication.translate("MainWindow", u"---", None))
self.modelLabel.setText(QCoreApplication.translate("MainWindow", u"MODEL", None))
self.model.setText(QCoreApplication.translate("MainWindow", u"---", 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))
# retranslateUi