From b6218651e71578fdc2a4b64ff60e98943ceda9e0 Mon Sep 17 00:00:00 2001 From: asmithie13 Date: Mon, 18 Mar 2024 16:40:40 -0400 Subject: [PATCH] Updated red line block implementation. --- PLC_Files/__pycache__/Parser.cpython-311.pyc | Bin 3207 -> 3207 bytes .../__pycache__/Block.cpython-311.pyc | Bin 1069 -> 1069 bytes Wayside SW/app.py | 61 +++++++++++++++--- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/PLC_Files/__pycache__/Parser.cpython-311.pyc b/PLC_Files/__pycache__/Parser.cpython-311.pyc index aa9a82315b47679b6d1c9ed9f25822629b0a6084..84d62b94fcc338d346bef2b73c1eba42ec488761 100644 GIT binary patch delta 20 acmZpdY?tI-&dbZi00hsc{n*G|!vg>|hy~C9 delta 20 acmZpdY?tI-&dbZi00eADK5XQ!;Q;_KO$8MI diff --git a/Track_Resources/__pycache__/Block.cpython-311.pyc b/Track_Resources/__pycache__/Block.cpython-311.pyc index e02881d5a5db8782a926906971599c714549fa5e..b997ade273e3a97c05b078c6398a8e2a352a2f94 100644 GIT binary patch delta 20 acmZ3>v6h2-IWI340}wo)_G2Tr5(@x13v6h2-IWI340}!Yl`LK~&i3I>Oss#K1 diff --git a/Wayside SW/app.py b/Wayside SW/app.py index e00b296f..38dea443 100644 --- a/Wayside SW/app.py +++ b/Wayside SW/app.py @@ -93,12 +93,18 @@ def __init__(self): #Defines Red line blocks self.redCrossingTriplesIDS = [] #ids of red crossing blocks self.allRedBlocks = readTrackFile("Red_Line.csv",self.redCrossingTriplesIDS) - self.specialRedBlocks = [] - self.redWayside1Blocks = [] - self.redWayside2Blocks = [] + self.specialRedBlocksW1 = [] + self.specialRedBlocksW2 = [] - for block in self.allRedBlocks: - if block.LIGHT or block.CROSSING or block.SWITCH : self.specialRedBlocks.append(block) + wayside1Chars = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] + self.redWayside1Blocks = [x for x in self.allRedBlocks if x.blockSection in wayside1Chars] + self.redWayside2Blocks = [x for x in self.allRedBlocks if x.blockSection not in wayside1Chars] + + for block in self.redWayside1Blocks: + if block.LIGHT or block.CROSSING or block.SWITCH : self.specialRedBlocksW1.append(block) + + for block in self.redWayside2Blocks: + if block.LIGHT or block.CROSSING or block.SWITCH : self.specialRedBlocksW2.append(block) #Create Parser Object self.currentSwitchBlocksNums = [['5','6','11']] @@ -193,17 +199,33 @@ def checkLine(self): self.waysideMenu.clear() self.waysideMenu.setEnabled(True) self.waysideMenu.addItems(['W1']) + self.selectWayside() elif checkRed: self.selectGreenLine.setDisabled(True) self.waysideMenu.clear() self.waysideMenu.setEnabled(True) self.waysideMenu.addItems(['W1','W2']) + self.selectWayside() else: self.selectGreenLine.setEnabled(True) self.selectRedLine.setEnabled(True) self.waysideMenu.setEnabled(False) + self.blockMenu.setDisabled(True) + + self.greenButton.setStyleSheet("") + self.redButton.setStyleSheet("") + self.upCrossingButton.setStyleSheet("") + self.downCrossingButton.setStyleSheet("") + + self.greenButton.setEnabled(False) + self.redButton.setEnabled(False) + self.upCrossingButton.setEnabled(False) + self.downCrossingButton.setEnabled(False) + self.switchButton.setEnabled(False) + + self.label_11.setText("") def selectWayside(self): selectedIndex = self.waysideMenu.currentIndex() @@ -222,11 +244,34 @@ def selectWayside(self): self.currentSwitchBlocksNums = self.greenCrossingTriplesIDS self.FileParser = Parser(None,self.greenCrossingTriplesIDS,self.allGreenBlocks) - #self.FileParser = Parser(None,None,self.currentBlocks) - #elif selectedIndex == 0 and self.selectRedLine.isChecked(): - #finish red blocks for W1 and W2 + if selectedIndex == 0 and self.selectRedLine.isChecked(): + self.currentBlocks = self.redWayside1Blocks + self.currentSpecialBlocks = self.specialRedBlocksW1 + self.blockMenu.setDisabled(False) + + self.blockMenu.clear() + + for block in self.currentSpecialBlocks: + self.blockMenu.addItems([block.ID]) + + self.currentSwitchBlocksNums = self.redCrossingTriplesIDS + + self.FileParser = Parser(None,self.redCrossingTriplesIDS,self.allRedBlocks) + + if selectedIndex == 1 and self.selectRedLine.isChecked(): + self.currentBlocks = self.redWayside2Blocks + self.currentSpecialBlocks = self.specialRedBlocksW2 + self.blockMenu.setDisabled(False) + + self.blockMenu.clear() + + for block in self.currentSpecialBlocks: + self.blockMenu.addItems([block.ID]) + + self.currentSwitchBlocksNums = self.redCrossingTriplesIDS + self.FileParser = Parser(None,self.redCrossingTriplesIDS,self.allRedBlocks) def blockActions(self): selectedIndex = self.blockMenu.currentIndex()