In https://github.com/albertaloop/T_SWE_2022_2023/tree/GUI/main, our current UI was generated from the QTDesigner file "AlbertaLoop_UI2.ui" to the python file "AlbertaLoop_UI2.py". The python file "main2.py" is the entry point for the back end of the GUI.
After running "main2.py" you should see a window like this:
In the middle of the window are labels which represent the current state of the pod. One label should be colored at a time depending on the reported state from the pod. The labels should follow this color scheme:
Fault : red
Safe to approach : light blue
Ready to Launch : green
Launch : green
Coasting : green
Braking : yellow
Crawling : yellow
In "main2.py" there is a class MWindowWrapper which inherits from Ui_MainWindow which is declared in "AlbertaLoop_UI2.py". We will need to add methods to MWindowWrapper to complete this task.
Acceptance Criteria
[x] Add methods "notify(state)" and "updateCurrentState(state)" to MWindowWrapper. We will use "notify(state)" to call "updateCurrentState(state)" and other methods which will be added later. We will also change the method signature of "notify()" later.
[x] Create a field in MWindowWrapper called "current_state"
[x] Inside updateCurrentState(state), first check if "state" matches "current_state". If there is no match, set "current_state = state", and use either a switch statement or if-else blocks to handle the following values of state: "fault", "safe", "ready", "launch", "coast", "brake", "crawl". In each case, change the corresponding label to it's correct color, and set the previous state label back to grey.
[x] Change the clicked.connect() function of one of the UI buttons to call "self.notify(state)" so you can use an existing UI button to test if the state labels change color correctly.
Summary
In https://github.com/albertaloop/T_SWE_2022_2023/tree/GUI/main, our current UI was generated from the QTDesigner file "AlbertaLoop_UI2.ui" to the python file "AlbertaLoop_UI2.py". The python file "main2.py" is the entry point for the back end of the GUI.
After running "main2.py" you should see a window like this:
In the middle of the window are labels which represent the current state of the pod. One label should be colored at a time depending on the reported state from the pod. The labels should follow this color scheme:
Fault : red Safe to approach : light blue Ready to Launch : green Launch : green Coasting : green Braking : yellow Crawling : yellow
In "main2.py" there is a class MWindowWrapper which inherits from Ui_MainWindow which is declared in "AlbertaLoop_UI2.py". We will need to add methods to MWindowWrapper to complete this task.
Acceptance Criteria