Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tc connect power to main UI #72

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/ECE-1140.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file removed Train Controller HW/test.txt
Empty file.
413 changes: 0 additions & 413 deletions Train Controller HW/test_lauren_ui.py

This file was deleted.

1 change: 1 addition & 0 deletions Train Controller SW/Failure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,19 @@ def set_headlights(self):
self.ui.buttonHDoff.toggle()
def set_power_failure(self):
if(not(self.PowerFailure.isChecked())):
self.ui.PwrFail.setStyleSheet("color: rgb(225, 225, 225);\n"
"background-color: rgb(255, 255, 255);")

self.ui.Power_Failure_Disable()
else:
self.ui.PwrFail.setStyleSheet("color: red;\n"
"background-color: rgb(255, 255, 255);")
self.ui.Power_Failure_Enable()
def set_brake_failure(self):
if(not(self.BrakeFailure.isChecked())):
self.ui.BrkFail.setStyleSheet("color: rgb(225, 225, 225);\n"
"background-color: rgb(255, 255, 255);")
self.ui.Brake_Failure_Disable()
else:
self.ui.BrkFail.setStyleSheet("color: red;\n"
"background-color: rgb(255, 255, 255);")
self.ui.Brake_Failure_Enable()
def set_signal_failure(self):
if(not(self.SignalFailure.isChecked())):
self.ui.SigFail.setStyleSheet("color: rgb(225, 225, 225);\n"
"background-color: rgb(255, 255, 255);")
self.ui.Signal_Failure_Disable()
else:
self.ui.SigFail.setStyleSheet("color: red;\n"
"background-color: rgb(255, 255, 255);")
self.ui.Signal_Failure_Enable()

def set_interior_lights(self):
if self.CabinLights.value() == 2:
Expand Down Expand Up @@ -77,8 +70,11 @@ def set_speed_limit(self):
self.ui.lcdSpdLim.display(value)

def set_current_speed(self):
value = int(self.CurSpeed.value())
self.ui.lcdCurSpd_2.display(value)
# in future iterations, move this to the UI function
if (self.ui.lcdAuth.value() == 0):
self.ui.lcdCurSpd.display(0)
else:
self.ui.lcdCurSpd.display(self.CurSpeed.value())

def set_authority(self):
value = int(self.Authority.value())
Expand Down Expand Up @@ -120,6 +116,7 @@ def setupUi(self, TestBench):
self.label_7.setObjectName("label_7")
self.formLayout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.label_7)
self.Authority = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.Authority.setRange(0,9999)
self.Authority.setObjectName("Authority")
self.Authority.editingFinished.connect( lambda : self.set_authority())
self.formLayout.setWidget(10, QtWidgets.QFormLayout.FieldRole, self.Authority)
Expand Down Expand Up @@ -247,11 +244,12 @@ def setupUi(self, TestBench):
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.Auto = QtWidgets.QPushButton(self.centralwidget, clicked = lambda : self.set_automatic_manual())
self.Auto.setCheckable(True)
self.Auto.setChecked(True)
self.Auto.setChecked(False)
self.Auto.setObjectName("Auto")
self.horizontalLayout_5.addWidget(self.Auto)
self.Manual = QtWidgets.QPushButton(self.centralwidget, clicked = lambda : self.set_automatic_manual())
self.Manual.setCheckable(True)
self.Manual.setChecked(True)
self.Manual.setObjectName("Manual")
self.horizontalLayout_5.addWidget(self.Manual)
self.formLayout.setLayout(21, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_5)
Expand Down Expand Up @@ -333,6 +331,11 @@ def retranslateUi(self, TestBench):
self.Auto.setText(_translate("TestBench", "Auto"))
self.Manual.setText(_translate("TestBench", "Manual"))

self.Authority.valueChanged.connect(lambda : self.Trigger_Authoirty_Countdown())
self.CurSpeed.valueChanged.connect(lambda : self.ui.calSpeed())

def Trigger_Authoirty_Countdown(self):
self.ui.calcAuth()
def Open_Main_UI(self):
self.window = QtWidgets.QMainWindow()
self.ui = Ui_MainWindow()
Expand Down
Loading