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

Ready for it 2 #75

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
24 changes: 12 additions & 12 deletions Track Model/Track_Model.ui
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>932</width>
<height>681</height>
<width>921</width>
<height>710</height>
</rect>
</property>
<property name="sizePolicy">
@@ -50,8 +50,8 @@
<property name="geometry">
<rect>
<x>20</x>
<y>450</y>
<width>501</width>
<y>480</y>
<width>521</width>
<height>171</height>
</rect>
</property>
@@ -147,8 +147,8 @@
<rect>
<x>20</x>
<y>70</y>
<width>501</width>
<height>281</height>
<width>521</width>
<height>291</height>
</rect>
</property>
<property name="frameShape">
@@ -170,7 +170,7 @@
<x>580</x>
<y>70</y>
<width>311</width>
<height>391</height>
<height>411</height>
</rect>
</property>
<property name="styleSheet">
@@ -449,7 +449,7 @@
<property name="geometry">
<rect>
<x>580</x>
<y>470</y>
<y>500</y>
<width>311</width>
<height>151</height>
</rect>
@@ -575,7 +575,7 @@
<rect>
<x>20</x>
<y>10</y>
<width>501</width>
<width>521</width>
<height>51</height>
</rect>
</property>
@@ -691,8 +691,8 @@
<property name="geometry">
<rect>
<x>20</x>
<y>360</y>
<width>501</width>
<y>380</y>
<width>521</width>
<height>81</height>
</rect>
</property>
@@ -787,7 +787,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>932</width>
<width>921</width>
<height>22</height>
</rect>
</property>
Binary file modified Track Model/__pycache__/main_window_ui.cpython-39.pyc
Binary file not shown.
22 changes: 11 additions & 11 deletions Track Model/app.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
from Track_Resources.Block import Block
from PyQt5 import QtCore as qtc
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5 import QtGui as qtg
from PyQt5 import QtGui as qtg

#My main window
class MyMainWindow(QMainWindow):
@@ -44,13 +44,13 @@ def __init__(self):

# Set default state for toggle button (default color should be red and "OFF") on all 3 buttons
self.offButton_1.setText("OFF")
self.offButton_1.setStyleSheet("background-color: red;")
self.offButton_1.setStyleSheet("background-color: rgb(195, 16, 40);")

self.offButton_2.setText("OFF")
self.offButton_2.setStyleSheet("background-color: red;")
self.offButton_2.setStyleSheet("background-color: rgb(195, 16, 40);")

self.offButton_3.setText("OFF")
self.offButton_3.setStyleSheet("background-color: red;")
self.offButton_3.setStyleSheet("background-color: rgb(195, 16, 40);")

# Instantiate the Data class
self.data = Data()
@@ -75,7 +75,7 @@ def toggle_button_state(self):
self.offButton_1.setStyleSheet("background-color: green;")
else:
self.offButton_1.setText("OFF")
self.offButton_1.setStyleSheet("background-color: red;")
self.offButton_1.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_button_state_tb(self, bool1):
# Toggle button state and color button for block broken rail but used from tb to main
@@ -84,7 +84,7 @@ def toggle_button_state_tb(self, bool1):
self.offButton_1.setStyleSheet("background-color: green;")
elif bool1.lower() in ["no", "false", "off", "0"]:
self.offButton_1.setText("OFF")
self.offButton_1.setStyleSheet("background-color: red;")
self.offButton_1.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_button_state_2(self):
# Toggle button state and color button for track circuit failure
@@ -93,7 +93,7 @@ def toggle_button_state_2(self):
self.offButton_2.setStyleSheet("background-color: green;")
else:
self.offButton_2.setText("OFF")
self.offButton_2.setStyleSheet("background-color: red;")
self.offButton_2.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_button_state_2_tb(self, bool1):
# Toggle button state and color button for block track circuit failure but used from tb to main
@@ -102,7 +102,7 @@ def toggle_button_state_2_tb(self, bool1):
self.offButton_2.setStyleSheet("background-color: green;")
elif bool1.lower() in ["no", "false", "off", "0"]:
self.offButton_2.setText("OFF")
self.offButton_2.setStyleSheet("background-color: red;")
self.offButton_2.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_button_state_3(self):
# toggle button state and color button for power failure
@@ -111,7 +111,7 @@ def toggle_button_state_3(self):
self.offButton_3.setStyleSheet("background-color: green;")
else:
self.offButton_3.setText("OFF")
self.offButton_3.setStyleSheet("background-color: red;")
self.offButton_3.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_button_state_3_tb(self, bool1):
# Toggle button state and color button for power_failure but used from tb to main
@@ -120,7 +120,7 @@ def toggle_button_state_3_tb(self, bool1):
self.offButton_3.setStyleSheet("background-color: green;")
elif bool1.lower() in ["no", "false", "off", "0"]:
self.offButton_3.setText("OFF")
self.offButton_3.setStyleSheet("background-color: red;")
self.offButton_3.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_light_state_tb(self, bool1):
# Toggle the state and color of the light button
@@ -129,7 +129,7 @@ def toggle_light_state_tb(self, bool1):
self.light_out.setStyleSheet("background-color: green;")
elif bool1.lower() == "red":
self.light_out.setText("RED")
self.light_out.setStyleSheet("background-color: red;")
self.light_out.setStyleSheet("background-color: rgb(195, 16, 40);")

def toggle_cross_state_tb(self, bool1):
# Toggle the state of the railway crossing
20 changes: 10 additions & 10 deletions Track Model/testbench_trackmodel.ui
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>884</width>
<height>475</height>
<height>554</height>
</rect>
</property>
<property name="windowTitle">
@@ -26,7 +26,7 @@
<x>9</x>
<y>9</y>
<width>431</width>
<height>431</height>
<height>501</height>
</rect>
</property>
<property name="styleSheet">
@@ -90,7 +90,7 @@
</string>
</property>
<property name="text">
<string>Commanded Speed: </string>
<string>Commanded Speed (mph): </string>
</property>
</widget>
</item>
@@ -111,7 +111,7 @@
</string>
</property>
<property name="text">
<string>Authority:</string>
<string>Authority (ft):</string>
</property>
</widget>
</item>
@@ -244,7 +244,7 @@
</string>
</property>
<property name="text">
<string>Railway Crossings: </string>
<string>Railway Crossings (Up/Down): </string>
</property>
</widget>
</item>
@@ -265,7 +265,7 @@
</string>
</property>
<property name="text">
<string>Lights:</string>
<string>Lights (Red/Green):</string>
</property>
</widget>
</item>
@@ -307,7 +307,7 @@
</string>
</property>
<property name="text">
<string>Broken Rail</string>
<string>Broken Rail (Off/On):</string>
</property>
</widget>
</item>
@@ -328,7 +328,7 @@
</string>
</property>
<property name="text">
<string>Track Circuit Failure: </string>
<string>Track Circuit Failure (Off/On): </string>
</property>
</widget>
</item>
@@ -349,7 +349,7 @@
</string>
</property>
<property name="text">
<string>Power Failure:</string>
<string>Power Failure (Off/On):</string>
</property>
</widget>
</item>
@@ -370,7 +370,7 @@
<x>470</x>
<y>10</y>
<width>401</width>
<height>421</height>
<height>501</height>
</rect>
</property>
<property name="styleSheet">