GUI Scripts¶
These scripts directly generate the GUI pages seen on the Raspberry Pi Device
Login_file.py¶
This file is responsible for creating the login page of the Wheelchair GUI
- class Login_file.Login(*args: Any, **kwargs: Any)¶
This class creates the login dialog to precede the other GUI pages
- __init__(parent=None)¶
This function will initialized the login page
- Parameters
parent – the parent upon which to establish the login page
- clearPin()¶
This function clears the text field
- enterPin(n)¶
This function enters a number from the pin pad into the text field
- Parameters
n – The number to enter from the pin pad
- handleLogin()¶
This function verifies that the password entered by the user matches the established password
- retranslateUi()¶
This function will reassign some components’ textual content
WCharging.py¶
This file is responsible for creating the Charging page of the Wheelchair’s GUI
- class WCharging.Ui_MainWindow2¶
This class creates the main window that is used as the Charging ‘tab’
- ConnectToCharger(event=None)¶
This function will initiate a connection or disconnect from the charger depending on the current state (this function is directly linked to the connect/disconnect button)
- Parameters
event – unused parameter that may be sent when initiated from a button call
- DisconnectFromCharger()¶
This function will disconnect the Wheelchair from the Charger (may be internally executed from bluetooth instruction in
WCharging.Ui_MainWindow2.data_received
- RequestCharging()¶
This function will request charging from the charger given it is in the connected state
- StartStopCharge(event=None)¶
This function will Start or stop charging depending on the current state (this function is directly linked to the start/stop button)
- Parameters
event – unused parameter that may be sent when initiated from a button call
- __weakref__¶
list of weak references to the object (if defined)
- _readParam()¶
This function will read the BMS Voltage and Current values from the data file then update the corresponding LCD elements and battery icon
- connect_BLU(c)¶
This function will attempt to initiate a bluetooth connection
- Parameters
c – Object reference on which to create a bluetooth connection
- data_received()¶
This function interprets data received over bluetooth connection from the Raspberry Pi on the Charger’s side
- Parameters
data – numeral instruction corresponding to the established communication lookup table
- disconnect_BLU(c)¶
This function will terminate a bluetooth connection
- Parameters
c – Object reference with an active bluetooth connection
- retranslateUi(MainWindow2)¶
This function will reassign some components’ textual content
- Parameters
MainWindow2 – parent window of the target components
- send_BLU(c, data)¶
This function will send data over an active bluetooth connection
- Parameters
c – Object reference with an active bluetooth connection
data – Data to send over the connection
- setColor(r, g, b, *objs)¶
This function will change the color of provided objects, given the rgb values
- Parameters
r – rgb value for red
g – rgb value for green
b – rgb value for blue
objs – objects to change the color of
- setGreen(*objs)¶
This function will change the color of provided objects to green (rgb: 0, 130, 0), using
WCharging.Ui_MainWindow2.setColor- Parameters
objs – objects to change the color of
- setGrey(*objs)¶
This function will change the color of provided objects to Grey (rgb: 202, 202, 202), using
WCharging.Ui_MainWindow2.setColor- Parameters
objs – objects to change the color of
- setRed(*objs)¶
This function will change the color of provided objects to red (rgb: 222, 0, 0), using
WCharging.Ui_MainWindow2.setColor- Parameters
objs – objects to change the color of
- setState(state=State.CHARGER_UNAVAILABLE)¶
This function sets the state of the Wheelchair and updates components using
WCharging.Ui_MainWindow2.stateUpdate- Parameters
state – The state which the Wheelchair will be set to, available options defined in
StateClass.State
- setupUi(MainWindow2)¶
This function will set up the UI elements that will be present on this window
- Parameters
MainWindow2 – the window on which to build the elements
- stateUpdate()¶
This function is the ‘brains’ of the state machine on the Wheelchair side. Each time it is called it updates the relevent GUI components corresponding to the active state as defined by
StateClass.State
WHome.py¶
This file is responsible for creating the Home page of the Wheelchair GUI
- class WHome.Ui_MainWindow¶
This class creates the main window that is used as the Home ‘tab’
- __weakref__¶
list of weak references to the object (if defined)
- _readParam()¶
This function will update the battery icon using the BMS values
- retranslateUi(MainWindow)¶
This function will reassign some components’ textual content
- Parameters
MainWindow – parent window of the target components
- setupUi(MainWindow)¶
This function will set up the UI elements that will be present on this window
- Parameters
MainWindow – the window on which to build the elements
WTest.py¶
This file is responsible for creating the Test page in the Wheelchair GUI
- class WTest.Ui_MainWindow3¶
This class creates the Wheelchair GUI’s Test ‘tab’
- __weakref__¶
list of weak references to the object (if defined)
- _readParam()¶
This function will read the Voltage and Current values from the data file every 5 seconds and update the corresponding labels
- clearPin()¶
This function clears the focused text field
- decimalPin()¶
This function enters a decimal from the pin pad into the focused text field and ensures there are no duplicate decimals
- enterNum(n)¶
This function enters a number from the pin pad into the focused text field
- Parameters
n – The number to enter from the pin pad
- retranslateUi(MainWindow)¶
This function will reassign some components’ textual content
- Parameters
MainWindow – parent window of the target components
- sendStart()¶
This function will send a start command from the wheelchair to the charger with the provided V/I input and will receive the Charger’s response
- sendStop()¶
This function will send a stop command from the wheelchair to the charger :return:
- setLineFocus(lineObj)¶
This function sets the line focus of the pin pad to the specified lineEdit object
- Parameters
lineObj – the QLineEdit object to focus
- setupUi(MainWindow)¶
This function will set up the UI elements that will be present on this window
- Parameters
MainWindow – the window on which to build the elements